diff options
author | Jason Merrill <jason@redhat.com> | 2013-03-20 23:25:42 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-03-20 23:25:42 -0400 |
commit | efcf217b1c9e82dc377feaeeb6ba86001d0a9d95 (patch) | |
tree | ba4ebb1ef7c7e87b6e92a85b018f824fc66f9f69 /gcc | |
parent | deaae9d7c73f87cfd2a0125411fdc54824b5d410 (diff) | |
download | gcc-efcf217b1c9e82dc377feaeeb6ba86001d0a9d95.zip gcc-efcf217b1c9e82dc377feaeeb6ba86001d0a9d95.tar.gz gcc-efcf217b1c9e82dc377feaeeb6ba86001d0a9d95.tar.bz2 |
re PR c++/56646 (ICE: in cp_parser_late_return_type_opt, at cp/parser.c:16970)
PR c++/56646
* parser.c (cp_parser_late_return_type_opt): Save and restore
current_class_ptr/ref.
From-SVN: r196853
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/trailing9.C | 12 |
3 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 64a085c..7045838 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-03-20 Jason Merrill <jason@redhat.com> + PR c++/56646 + * parser.c (cp_parser_late_return_type_opt): Save and restore + current_class_ptr/ref. + PR c++/54532 * expr.c (cplus_expand_constant): Do nothing if the class is incomplete. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 23fe3f3..e04d3ce 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17056,17 +17056,21 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals) /* Consume the ->. */ cp_lexer_consume_token (parser->lexer); + tree save_ccp = current_class_ptr; + tree save_ccr = current_class_ref; if (quals >= 0) { /* DR 1207: 'this' is in scope in the trailing return type. */ - gcc_assert (current_class_ptr == NULL_TREE); inject_this_parameter (current_class_type, quals); } type = cp_parser_trailing_type_id (parser); if (quals >= 0) - current_class_ptr = current_class_ref = NULL_TREE; + { + current_class_ptr = save_ccp; + current_class_ref = save_ccr; + } return type; } diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing9.C b/gcc/testsuite/g++.dg/cpp0x/trailing9.C new file mode 100644 index 0000000..d7895b3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/trailing9.C @@ -0,0 +1,12 @@ +// PR c++/56646 +// { dg-require-effective-target c++11 } + +struct A { + void f(); +}; + +void A::f() { + struct B { + auto g() -> void { } + }; +} |