diff options
author | Jason Merrill <jason@redhat.com> | 2017-02-20 01:05:08 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-02-20 01:05:08 -0500 |
commit | de59c92b44f5e67a90268e2d0f6f3efd6c8e3354 (patch) | |
tree | d7c91db51add3280adf8cbc042c28e515b0a3de3 /gcc | |
parent | b80dfe4441b689217cb3aefbc24c90d97b17d154 (diff) | |
download | gcc-de59c92b44f5e67a90268e2d0f6f3efd6c8e3354.zip gcc-de59c92b44f5e67a90268e2d0f6f3efd6c8e3354.tar.gz gcc-de59c92b44f5e67a90268e2d0f6f3efd6c8e3354.tar.bz2 |
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.
From-SVN: r245587
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/complit15.C | 8 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9b071eb..79fee99 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index feeafce..4656b4f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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); } diff --git a/gcc/testsuite/g++.dg/ext/complit15.C b/gcc/testsuite/g++.dg/ext/complit15.C new file mode 100644 index 0000000..f12752d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/complit15.C @@ -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); |