re PR c++/51463 ([c++0x] [4.7 Regression] ICE declaring a member function virtual and static)

PR c++/51463
	* decl.c (grokdeclarator): Set DECL_INITIAL of decl
	to error_mark_node to disallow NSDMI if declspecs->storage_class
	is sc_static.
	* parser.c (cp_parser_late_parse_one_default_arg): Return early
	if default_arg is error_mark_node.

	* g++.dg/cpp0x/pr51463.C: New test.

From-SVN: r182387
This commit is contained in:
Jakub Jelinek 2011-12-15 21:45:53 +01:00 committed by Jakub Jelinek
parent 666b67b1b9
commit e1b750d87f
5 changed files with 33 additions and 4 deletions

View File

@ -1,5 +1,12 @@
2011-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/51463
* decl.c (grokdeclarator): Set DECL_INITIAL of decl
to error_mark_node to disallow NSDMI if declspecs->storage_class
is sc_static.
* parser.c (cp_parser_late_parse_one_default_arg): Return early
if default_arg is error_mark_node.
PR c/51360
* semantics.c (finish_omp_clauses): For OMP_CLAUSE_NUM_THREADS_EXPR
and OMP_CLAUSE_SCHEDULE_CHUNK_EXPR call mark_rvalue_use.

View File

@ -10220,9 +10220,17 @@ grokdeclarator (const cp_declarator *declarator,
}
if (initialized)
/* An attempt is being made to initialize a non-static
member. This is new in C++11. */
maybe_warn_cpp0x (CPP0X_NSDMI);
{
/* An attempt is being made to initialize a non-static
member. This is new in C++11. */
maybe_warn_cpp0x (CPP0X_NSDMI);
/* If this has been parsed with static storage class, but
errors forced staticp to be cleared, ensure NSDMI is
not present. */
if (declspecs->storage_class == sc_static)
DECL_INITIAL (decl) = error_mark_node;
}
}
bad_specifiers (decl, BSP_FIELD, virtualp,

View File

@ -21853,6 +21853,9 @@ cp_parser_late_parse_one_default_arg (cp_parser *parser, tree decl,
tree parsed_arg;
bool dummy;
if (default_arg == error_mark_node)
return error_mark_node;
/* Push the saved tokens for the default argument onto the parser's
lexer stack. */
tokens = DEFARG_TOKENS (default_arg);

View File

@ -1,11 +1,14 @@
2011-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/51463
* g++.dg/cpp0x/pr51463.C: New test.
PR c/51360
* c-c++-common/gomp/pr51360.c: New test.
* g++.dg/gomp/pr51360.C: New test.
PR middle-end/49806
* gcc.dg/tree-ssa-vrp47.c: Add -fdump-tree-dom2 to dg-options.
* gcc.dg/tree-ssa/vrp47.c: Add -fdump-tree-dom2 to dg-options.
Check for x_? & y in dom2 dump and xfail the check in dom1 dump.
PR tree-optimization/51117

View File

@ -0,0 +1,8 @@
// PR c++/51463
// { dg-do compile }
// { dg-options "-std=c++11" }
struct A
{
static virtual int i = 0; // { dg-error "both virtual and static|declared as" }
};