PR c++/28513
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Nov 2008 20:23:32 +0000 (20:23 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Nov 2008 20:23:32 +0000 (20:23 +0000)
        * parser.c (cp_parser_class_name): Call maybe_note_name_used_in_class.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142056 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/name-clash7.C [new file with mode: 0644]

index 558682b..9880815 100644 (file)
@@ -1,5 +1,8 @@
 2008-11-20  Jason Merrill  <jason@redhat.com>
 
+       PR c++/28513
+       * parser.c (cp_parser_class_name): Call maybe_note_name_used_in_class.
+
        PR c++/37540
        * call.c (build_over_call): Take the address of the function even
        in a template.
index 2bf0e66..8fdd58c 100644 (file)
@@ -14767,6 +14767,9 @@ cp_parser_class_name (cp_parser *parser,
                }
              return error_mark_node;
            }
+         else if (decl != error_mark_node
+                  && !parser->scope)
+           maybe_note_name_used_in_class (identifier, decl);
        }
     }
   else
index 43454d2..3437a0d 100644 (file)
@@ -1,5 +1,8 @@
 2008-11-20  Jason Merrill  <jason@redhat.com>
 
+       PR c++/28513
+       * g++.dg/lookup/name-clash7.C: New test.
+
        PR c++/37540
        * g++.dg/cpp0x/decltype14.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/lookup/name-clash7.C b/gcc/testsuite/g++.dg/lookup/name-clash7.C
new file mode 100644 (file)
index 0000000..5c0690a
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/28513
+
+class foo {                    // { dg-error "changes meaning" }
+public:
+  typedef int bar;
+};
+
+class baz {
+public:
+  foo::bar foo;                        // { dg-error "declaration" }
+};