]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/34399 (ICE on invalid friend declaration of variadic template)
authorDouglas Gregor <doug.gregor@gmail.com>
Tue, 15 Jan 2008 20:56:55 +0000 (20:56 +0000)
committerDoug Gregor <dgregor@gcc.gnu.org>
Tue, 15 Jan 2008 20:56:55 +0000 (20:56 +0000)
2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>

PR c++/34399
* friend.c (do_friend): Don't query TYPE_BEING_DEFINED unless we
know we have a class type.

2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>

PR c++/34399
* g++.dg/cpp0x/vt-34399.C: New.
* g++.dg/template/friend50.C: New.

From-SVN: r131552

gcc/cp/ChangeLog
gcc/cp/friend.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/vt-34399.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/friend50.C [new file with mode: 0644]

index 6fec22f833de438ffa0291013ea0b7f8dbc17671..cb78daa5d5537d0eec6e8a2ff75a7851c5ded468 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>
+
+       PR c++/34399
+       * friend.c (do_friend): Don't query TYPE_BEING_DEFINED unless we
+       know we have a class type.
+
 2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>
 
        PR c++/34751
index 95f98c45397304e1dab727ca0bf41a68da1f6923..094501b109a3762ea5bb61beaf68a6f47663fd92 100644 (file)
@@ -468,7 +468,7 @@ do_friend (tree ctype, tree declarator, tree decl,
         the process of being defined.  */
       if (class_template_depth
          || COMPLETE_TYPE_P (ctype)
-         || TYPE_BEING_DEFINED (ctype))
+         || (CLASS_TYPE_P (ctype) && TYPE_BEING_DEFINED (ctype)))
        {
          if (DECL_TEMPLATE_INFO (decl))
            /* DECL is a template specialization.  No need to
index c6184f91da7e058fe815394c8e6faa4ed87ff15c..c9d0e6a6923dc8f6f37a02f672e580dff3428b02 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>
+
+       PR c++/34399
+       * g++.dg/cpp0x/vt-34399.C: New.
+       * g++.dg/template/friend50.C: New.
+
 2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>
 
        PR c++/34751
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34399.C b/gcc/testsuite/g++.dg/cpp0x/vt-34399.C
new file mode 100644 (file)
index 0000000..542fae5
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-options "-std=c++0x" }
+template<int...> struct A
+{
+  void foo();
+};
+
+struct B
+{
+  template<int N> friend void A<N>::A::foo(); // { dg-error "declared as friend" }
+};
diff --git a/gcc/testsuite/g++.dg/template/friend50.C b/gcc/testsuite/g++.dg/template/friend50.C
new file mode 100644 (file)
index 0000000..93c429a
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/34399
+template<int> struct X
+{
+  void foo();
+};
+
+struct Y {
+  template<long N> friend void X<N>::X::foo(); // { dg-error "declared as friend" }
+};
This page took 0.136597 seconds and 5 git commands to generate.