]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/28111 (ICE with invalid friend in template class)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Thu, 22 Jun 2006 09:55:42 +0000 (09:55 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 22 Jun 2006 09:55:42 +0000 (09:55 +0000)
PR c++/28111
* pt.c (determine_specialization): Check for invalid decls.

* g++.dg/template/friend43.C: New test.

From-SVN: r114887

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/friend43.C [new file with mode: 0644]

index ac044d179f9b655f554bcc70553ecc2b000b72db..ec07436f48ccc9bf0c5d6e07c0318748f2367849 100644 (file)
@@ -1,5 +1,8 @@
 2006-06-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/28111
+       * pt.c (determine_specialization): Check for invalid decls.
+
        PR c++/28110
        * pt.c (unify) <case TEMPLATE_PARM_INDEX>: Check for invalid
        parameters.
index f7bc7ce59a5cc04b380b7024c950c22241d9d01d..89afb5fe3b94e02102638c8ea4b1dd4d58856caa 100644 (file)
@@ -1354,7 +1354,7 @@ determine_specialization (tree template_id,
 
   *targs_out = NULL_TREE;
 
-  if (template_id == error_mark_node)
+  if (template_id == error_mark_node || decl == error_mark_node)
     return error_mark_node;
 
   fns = TREE_OPERAND (template_id, 0);
index a02dc4c4c285561f6eee9bb517dacc98c22876fe..013608b262a449a0093ac079d60c82c5274d484a 100644 (file)
@@ -1,5 +1,8 @@
 2006-06-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/28111
+       * g++.dg/template/friend43.C: New test.
+
        PR c++/28110
        * g++.dg/template/crash53.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/friend43.C b/gcc/testsuite/g++.dg/template/friend43.C
new file mode 100644 (file)
index 0000000..edbed84
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/28111
+// { dg-do compile }
+
+template<typename> void foo();
+
+template<typename T> struct A
+{
+  friend void foo<>(typename T::X);  // { dg-error "not a class" }
+};
+
+A<int> a;