diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-20 17:13:47 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-20 17:13:47 +0000 |
commit | 65b7c3044e1e355984408d457ddad933af288fa6 (patch) | |
tree | 8374e95e085b76ea9278b61fa12de7e51d6bc314 /gcc | |
parent | ac41761929fe8258e7ef3b206ad67d6530ac4789 (diff) | |
download | gcc-65b7c3044e1e355984408d457ddad933af288fa6.tar.gz |
/cp
2013-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/12288
* parser.c (cp_parser_parameter_declaration): Check return value
of cp_parser_parse_and_diagnose_invalid_type_name.
/testsuite
2013-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/12288
* g++.dg/parse/error52.C: New.
* g++.dg/parse/error3.C: Adjust.
* g++.dg/parse/error36.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199115 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error3.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error36.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error52.C | 11 |
6 files changed, 27 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b08afd929f5..d1e3bb65c36 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-05-20 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/12288 + * parser.c (cp_parser_parameter_declaration): Check return value + of cp_parser_parse_and_diagnose_invalid_type_name. + 2013-05-20 Jason Merrill <jason@redhat.com> PR c++/57319 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 91e6615ae38..c3096d372ab 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17844,8 +17844,9 @@ cp_parser_parameter_declaration (cp_parser *parser, &declares_class_or_enum); /* Complain about missing 'typename' or other invalid type names. */ - if (!decl_specifiers.any_type_specifiers_p) - cp_parser_parse_and_diagnose_invalid_type_name (parser); + if (!decl_specifiers.any_type_specifiers_p + && cp_parser_parse_and_diagnose_invalid_type_name (parser)) + decl_specifiers.type = error_mark_node; /* If an error occurred, there's no reason to attempt to parse the rest of the declaration. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85aac1e2a10..4e8e6e4282d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-05-20 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/12288 + * g++.dg/parse/error52.C: New. + * g++.dg/parse/error3.C: Adjust. + * g++.dg/parse/error36.C: Likewise. + 2013-05-20 Oleg Endo <olegendo@gcc.gnu.org> PR target/56547 diff --git a/gcc/testsuite/g++.dg/parse/error3.C b/gcc/testsuite/g++.dg/parse/error3.C index 58739934156..938ab45b24c 100644 --- a/gcc/testsuite/g++.dg/parse/error3.C +++ b/gcc/testsuite/g++.dg/parse/error3.C @@ -5,5 +5,4 @@ static void InstantiateConstraint(const float&, unsigned, void(*AddFunction)(const TYPE&,bool&, char*, char*, unsigned*)); -// { dg-error "64: ISO C\\+\\+ forbids declaration of 'parameter' with no type" "forbids" { target *-*-* } { 5 } } // { dg-error "60: 'TYPE' does not name a type" "does not" { target *-*-* } { 5 } } diff --git a/gcc/testsuite/g++.dg/parse/error36.C b/gcc/testsuite/g++.dg/parse/error36.C index a99ad299d39..92e27a928df 100644 --- a/gcc/testsuite/g++.dg/parse/error36.C +++ b/gcc/testsuite/g++.dg/parse/error36.C @@ -26,7 +26,6 @@ template <class T> struct B // PR c++/40738 template <class T> void g(const A<T>::type &t); // { dg-error "typename" "typename" } -// { dg-error "no type" "no type" { target *-*-* } 28 } // PR c++/18451 template <class T> A<T>::B A<T>::b; // { dg-error "typename" } diff --git a/gcc/testsuite/g++.dg/parse/error52.C b/gcc/testsuite/g++.dg/parse/error52.C new file mode 100644 index 00000000000..d1c6e4a857d --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error52.C @@ -0,0 +1,11 @@ +// PR c++/12288 + +class X {}; + +struct S { + explicit S (const X::T&) {} // { dg-error "does not name a type" } +}; + +class Y {}; + +typedef Y::T xt; // { dg-error "does not name a type" } |