re PR c++/26571 (Bad diagnostic using type modifier with struct)
authorJason Merrill <jason@redhat.com>
Wed, 6 Sep 2006 05:28:08 +0000 (01:28 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 6 Sep 2006 05:28:08 +0000 (01:28 -0400)
        PR c++/26571
        * parser.c (cp_parser_diagnose_invalid_type_name): Handle the case
        where the name is a type used incorrectly.

From-SVN: r116715

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/parse/typespec1.C [new file with mode: 0644]

index 014c76bbb0a8045d1e9eb331ad7e9d9d231f140a..95933ac0245c979ab6df94db8d8a82890b3533c1 100644 (file)
@@ -1,5 +1,9 @@
 2006-09-05  Jason Merrill  <jason@redhat.com>
 
+       PR c++/26571
+       * parser.c (cp_parser_diagnose_invalid_type_name): Handle the case
+       where the name is a type used incorrectly.
+
        PR c++/26671
        * typeck.c (maybe_warn_about_returning_address_of_local): Look 
        through COMPONENT_REF and ARRAY_REF.    
index a4e5f37eece9a118bfbdff8e734b632255c8a6b7..41726f3e3b92368d94073e964fe9b215a3e37fcb 100644 (file)
@@ -2101,6 +2101,9 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
     error ("invalid use of template-name %qE without an argument list", decl);
   else if (TREE_CODE (id) == BIT_NOT_EXPR)
     error ("invalid use of destructor %qD as a type", id);
+  else if (TREE_CODE (decl) == TYPE_DECL)
+    /* Something like 'unsigned A a;'  */
+    error ("invalid combination of multiple type-specifiers");
   else if (!parser->scope)
     {
       /* Issue an error message.  */
diff --git a/gcc/testsuite/g++.dg/parse/typespec1.C b/gcc/testsuite/g++.dg/parse/typespec1.C
new file mode 100644 (file)
index 0000000..a371f8b
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/26571
+
+struct A {};
+unsigned A a;                  // { dg-error "multiple" }