Commit e1b750d8 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 666b67b1
2011-12-15 Jakub Jelinek <jakub@redhat.com> 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 PR c/51360
* semantics.c (finish_omp_clauses): For OMP_CLAUSE_NUM_THREADS_EXPR * semantics.c (finish_omp_clauses): For OMP_CLAUSE_NUM_THREADS_EXPR
and OMP_CLAUSE_SCHEDULE_CHUNK_EXPR call mark_rvalue_use. and OMP_CLAUSE_SCHEDULE_CHUNK_EXPR call mark_rvalue_use.
......
...@@ -10220,9 +10220,17 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10220,9 +10220,17 @@ grokdeclarator (const cp_declarator *declarator,
} }
if (initialized) if (initialized)
/* An attempt is being made to initialize a non-static {
member. This is new in C++11. */ /* An attempt is being made to initialize a non-static
maybe_warn_cpp0x (CPP0X_NSDMI); 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, bad_specifiers (decl, BSP_FIELD, virtualp,
......
...@@ -21853,6 +21853,9 @@ cp_parser_late_parse_one_default_arg (cp_parser *parser, tree decl, ...@@ -21853,6 +21853,9 @@ cp_parser_late_parse_one_default_arg (cp_parser *parser, tree decl,
tree parsed_arg; tree parsed_arg;
bool dummy; bool dummy;
if (default_arg == error_mark_node)
return error_mark_node;
/* Push the saved tokens for the default argument onto the parser's /* Push the saved tokens for the default argument onto the parser's
lexer stack. */ lexer stack. */
tokens = DEFARG_TOKENS (default_arg); tokens = DEFARG_TOKENS (default_arg);
......
2011-12-15 Jakub Jelinek <jakub@redhat.com> 2011-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/51463
* g++.dg/cpp0x/pr51463.C: New test.
PR c/51360 PR c/51360
* c-c++-common/gomp/pr51360.c: New test. * c-c++-common/gomp/pr51360.c: New test.
* g++.dg/gomp/pr51360.C: New test. * g++.dg/gomp/pr51360.C: New test.
PR middle-end/49806 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. Check for x_? & y in dom2 dump and xfail the check in dom1 dump.
PR tree-optimization/51117 PR tree-optimization/51117
......
// 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" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment