re PR c++/51148 ([C++0x] Unexpanded template param packs wrongly accepted in friend...
authorJason Merrill <jason@redhat.com>
Mon, 16 Apr 2012 14:15:36 +0000 (10:15 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 16 Apr 2012 14:15:36 +0000 (10:15 -0400)
PR c++/51148
* friend.c (make_friend_class): Call check_for_bare_parameter_packs.

From-SVN: r186495

gcc/cp/ChangeLog
gcc/cp/friend.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/variadic127.C [new file with mode: 0644]

index c511a1287500ad49ecd79f554fbb6974ac8d137c..5a3d3379eb0789bbd37476f825e15e05145f7d9b 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51148
+       * friend.c (make_friend_class): Call check_for_bare_parameter_packs.
+
 2012-04-16  Jan Hubicka  <jh@suse.cz>
 
        * decl2.c (collect_candidates_for_java_method_alias): Use FOR_EACH
index e532a30e3a3b053f921b1017b2ab841011124229..87a093a478e5373fc7834ca9009579f7877a09ac 100644 (file)
@@ -239,6 +239,9 @@ make_friend_class (tree type, tree friend_type, bool complain)
 
   friend_type = cv_unqualified (friend_type);
 
+  if (check_for_bare_parameter_packs (friend_type))
+    return;
+
   if (friend_depth)
     /* If the TYPE is a template then it makes sense for it to be
        friends with itself; this means that each instantiation is
index 847f90e815b698f7976d180cc9bb553e58902077..27df0fb8d92a97ba89170367dcea80a2ca9e5ea2 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51148
+       * g++.dg/cpp0x/variadic127.C: New.
+
 2012-04-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * lib/plugin-support.exp (plugin-test-execute): Properly determine
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic127.C b/gcc/testsuite/g++.dg/cpp0x/variadic127.C
new file mode 100644 (file)
index 0000000..2e0d593
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/51148
+// { dg-do compile { target c++11 } }
+
+template<typename... Types>
+struct S
+{};
+
+template<typename... Types>
+struct T
+{
+  friend class S<Types>;     // { dg-error "parameter packs not expanded" }
+};
+
+int main()
+{}