re PR c++/30863 (Unsigned templatized struct treated as unsigned int)
PR c++/30863 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do not consume tokens when failing. PR c++/30863 * g++.dg/template/error24.C: New test. * g++.dg/parse/tmpl-outside1.C: Tweak error markers. From-SVN: r123152
This commit is contained in:
parent
725d6b877d
commit
8b84995aa3
5 changed files with 24 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-03-22 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/30863
|
||||
* parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do
|
||||
not consume tokens when failing.
|
||||
|
||||
2007-03-22 Jim Wilson <wilson@specifix.com>
|
||||
Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
|
|
|
@ -2343,12 +2343,13 @@ cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser)
|
|||
the scope is dependent, we cannot do much. */
|
||||
if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME)
|
||||
|| (parser->scope && TYPE_P (parser->scope)
|
||||
&& dependent_type_p (parser->scope)))
|
||||
&& dependent_type_p (parser->scope))
|
||||
|| TREE_CODE (id) == TYPE_DECL)
|
||||
{
|
||||
cp_parser_abort_tentative_parse (parser);
|
||||
return false;
|
||||
}
|
||||
if (!cp_parser_parse_definitely (parser) || TREE_CODE (id) == TYPE_DECL)
|
||||
if (!cp_parser_parse_definitely (parser))
|
||||
return false;
|
||||
|
||||
/* Emit a diagnostic for the invalid type. */
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2007-03-22 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/30863
|
||||
* g++.dg/template/error24.C: New test.
|
||||
* g++.dg/parse/tmpl-outside1.C: Tweak error markers.
|
||||
|
||||
2007-03-22 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/31273
|
||||
|
|
|
@ -7,5 +7,4 @@ struct X
|
|||
template <int i> struct Y {};
|
||||
};
|
||||
|
||||
typedef X::template Y<0> y; // { dg-error "template" }
|
||||
// { dg-bogus "with no type" "" { xfail *-*-* } 10 }
|
||||
typedef X::template Y<0> y; // { dg-error "template|invalid" }
|
||||
|
|
8
gcc/testsuite/g++.dg/template/error24.C
Normal file
8
gcc/testsuite/g++.dg/template/error24.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// PR c++/30863
|
||||
|
||||
template <typename T>
|
||||
struct s {};
|
||||
|
||||
void f() {
|
||||
unsigned s<int> x; // { dg-error "invalid" }
|
||||
}
|
Loading…
Add table
Reference in a new issue