Skip to content

Commit

Permalink
PR c++/79580 - ICE with compound literal
Browse files Browse the repository at this point in the history
	* parser.c (cp_parser_class_head): If we're in the middle of an
	expression, use ts_within_enclosing_non_class.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245587 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jason committed Feb 20, 2017
1 parent 67378ae commit a37a80f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gcc/cp/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
2017-02-19 Jason Merrill <jason@redhat.com>

PR c++/79580 - ICE with compound literal
* parser.c (cp_parser_class_head): If we're in the middle of an
expression, use ts_within_enclosing_non_class.

PR c++/79503 - inherited ctor taking base class
* call.c (add_function_candidate): Also check that
DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
Expand Down
5 changes: 4 additions & 1 deletion gcc/cp/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -22771,7 +22771,10 @@ cp_parser_class_head (cp_parser* parser,
/* If the class was unnamed, create a dummy name. */
if (!id)
id = make_anon_name ();
type = xref_tag (class_key, id, /*tag_scope=*/ts_current,
tag_scope tag_scope = (parser->in_type_id_in_expr_p
? ts_within_enclosing_non_class
: ts_current);
type = xref_tag (class_key, id, tag_scope,
parser->num_template_parameter_lists);
}

Expand Down
8 changes: 8 additions & 0 deletions gcc/testsuite/g++.dg/ext/complit15.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// PR c++/79580
// { dg-options "-flto -std=c++98" }

class a
{
static const double b;
};
const double a::b ((union { double c; }){}.c);

0 comments on commit a37a80f

Please sign in to comment.