]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/19200 (Friend declaration misinterpreted as constructor)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 12 Jun 2014 01:29:42 +0000 (01:29 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 12 Jun 2014 01:29:42 +0000 (01:29 +0000)
/cp
2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/19200
* parser.c (cp_parser_init_declarator): Actually pass friend_p
to cp_parser_declarator.

/testsuite
2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/19200
* g++.dg/parse/friend11.C: New.

From-SVN: r211488

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/friend11.C [new file with mode: 0644]

index 8bd4a7389d233cc6ff3c0d3bd2aa333ffe543cee..70156ebe16adaa8b4fd28712f39f6a28d134c35e 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/19200
+       * parser.c (cp_parser_init_declarator): Actually pass friend_p
+       to cp_parser_declarator.
+
 2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/60265
index 4dff139ff5da3a6b9effd63d3e844cfff8ab5d88..1079832cec22e26e3cc6260db0fb2abd454e7d28 100644 (file)
@@ -16545,7 +16545,7 @@ cp_parser_init_declarator (cp_parser* parser,
   bool is_direct_init = false;
   bool is_non_constant_init;
   int ctor_dtor_or_conv_p;
-  bool friend_p;
+  bool friend_p = cp_parser_friend_p (decl_specifiers);
   tree pushed_scope = NULL_TREE;
   bool range_for_decl_p = false;
   bool saved_default_arg_ok_p = parser->default_arg_ok_p;
@@ -16574,7 +16574,7 @@ cp_parser_init_declarator (cp_parser* parser,
     = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
                            &ctor_dtor_or_conv_p,
                            /*parenthesized_p=*/NULL,
-                           member_p, /*friend_p=*/false);
+                           member_p, friend_p);
   /* Gather up the deferred checks.  */
   stop_deferring_access_checks ();
 
@@ -16746,9 +16746,6 @@ cp_parser_init_declarator (cp_parser* parser,
       decl_specifiers->type = integer_type_node;
     }
 
-  /* Check to see whether or not this declaration is a friend.  */
-  friend_p = cp_parser_friend_p (decl_specifiers);
-
   /* Enter the newly declared entry in the symbol table.  If we're
      processing a declaration in a class-specifier, we wait until
      after processing the initializer.  */
index 2a506f596c9dd00441af41884c9bac86713e75b1..3e9239545143649fcf21ff17271e2c80ea3082ae 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/19200
+       * g++.dg/parse/friend11.C: New.
+
 2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/60265
diff --git a/gcc/testsuite/g++.dg/parse/friend11.C b/gcc/testsuite/g++.dg/parse/friend11.C
new file mode 100644 (file)
index 0000000..61aae4e
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/19200
+
+struct S {
+  struct T{};
+  template<typename> friend void S(T);
+};