aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2006-09-06 01:28:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2006-09-06 01:28:08 -0400
commit5df1740de4c12ae9b6d6305069106683f8f82694 (patch)
tree42914114a5791d5f41233296c6693160f0278987 /gcc
parenta1a9524971df4d4991760ccb1189049f067c7e80 (diff)
downloadgcc-5df1740de4c12ae9b6d6305069106683f8f82694.zip
gcc-5df1740de4c12ae9b6d6305069106683f8f82694.tar.gz
gcc-5df1740de4c12ae9b6d6305069106683f8f82694.tar.bz2
re PR c++/26571 (Bad diagnostic using type modifier with struct)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c3
-rw-r--r--gcc/testsuite/g++.dg/parse/typespec1.C4
3 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 014c76b..95933ac 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index a4e5f37..41726f3 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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
index 0000000..a371f8b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/typespec1.C
@@ -0,0 +1,4 @@
+// PR c++/26571
+
+struct A {};
+unsigned A a; // { dg-error "multiple" }