diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c202af4d4ccc..b37326619153 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-17 Kai Tietz + + * class.c (note_name_declared_in_class): Make in 'extern "C"' blocks, + or if -fms-extensions is enabled check, check permissive. + 2010-08-09 Jason Merrill PR c++/45236 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 73bcb7598ee0..c00b7de794c4 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6807,7 +6807,13 @@ note_name_declared_in_class (tree name, tree decl) = current_class_stack[current_class_depth - 1].names_used; if (!names_used) return; - + /* The C language allows members to be declared with a type of the same + name, and the C++ standard says this diagnostic is not required. So + allow it in extern "C" blocks unless predantic is specified. + Allow it in all cases if -ms-extensions is specified. */ + if ((!pedantic && current_lang_name == lang_name_c) + || flag_ms_extensions) + return; n = splay_tree_lookup (names_used, (splay_tree_key) name); if (n) {