This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/51148 (missed error on unexpanded pack in friend declaration)


Just another place we need to call check_for_bare_parameter_packs.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 616afbea9bf859633ade63b6536e5b63be5a19e6
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 16 09:23:41 2012 -0400

    	PR c++/51148
    	* friend.c (make_friend_class): Call check_for_bare_parameter_packs.

diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index e532a30..87a093a 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -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
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic127.C b/gcc/testsuite/g++.dg/cpp0x/variadic127.C
new file mode 100644
index 0000000..2e0d593
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic127.C
@@ -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()
+{}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]