diff options
author | abutcher <abutcher@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-18 22:29:56 +0000 |
---|---|---|
committer | abutcher <abutcher@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-18 22:29:56 +0000 |
commit | 9460e32536ed626c4b9840f49f0fa210b7cf8dbc (patch) | |
tree | 372fac2018bea49dc5ac1e04d420662896e0bd99 | |
parent | 75468bd5524d1220de385401b2c83f61ca38e300 (diff) | |
download | gcc-9460e32536ed626c4b9840f49f0fa210b7cf8dbc.tar.gz |
Fix PR c++/60064.
PR c++/60064
* parser.c (cp_parser_member_declaration): Pop fully implicit template
scope for generic friend declarations as well as for non-friends.
PR c++/60064
* g++.dg/cpp1y/pr60064.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207856 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/pr60064.C | 21 |
4 files changed, 31 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0fd4b7f36b..e29e9dd0f39 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -5,6 +5,10 @@ scope whenever a template parameter list has been started, independent of whether the function call operator was well-formed or not. + PR c++/60064 + * parser.c (cp_parser_member_declaration): Pop fully implicit template + scope for generic friend declarations as well as for non-friends. + 2014-02-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60047 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 23d54fb1286..98182138e24 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -20406,13 +20406,11 @@ cp_parser_member_declaration (cp_parser* parser) &decl_specifiers, declarator, attributes); + if (parser->fully_implicit_function_template_p) + decl = finish_fully_implicit_template (parser, decl); /* If the member was not a friend, declare it here. */ if (!friend_p) - { - if (parser->fully_implicit_function_template_p) - decl = finish_fully_implicit_template (parser, decl); - finish_member_declaration (decl); - } + finish_member_declaration (decl); /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); /* If the next token is a semicolon, consume it. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 780614cc79b..855b0c2bc0f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -9,6 +9,9 @@ PR c++/60190 * g++.dg/cpp1y/pr60190.C: New testcase. + PR c++/60064 + * g++.dg/cpp1y/pr60064.C: New testcase. + 2014-02-18 Uros Bizjak <ubizjak@gmail.com> PR target/60205 diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60064.C b/gcc/testsuite/g++.dg/cpp1y/pr60064.C new file mode 100644 index 00000000000..21b043dddfe --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60064.C @@ -0,0 +1,21 @@ +// PR c++/60064 +// { dg-do compile } +// { dg-options "-std=c++1y" } + +class A +{ + int m; + friend void foo (auto) {} + friend void foo2 (auto); +}; + +void foo2 (auto i) +{ + A a; + a.m = i; +} + +int main () +{ + foo2 (7); +} |