re PR c++/13310 (Tree check error in dependent_template_p)
authorMark Mitchell <mark@codesourcery.com>
Mon, 15 Dec 2003 21:55:19 +0000 (21:55 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 15 Dec 2003 21:55:19 +0000 (21:55 +0000)
PR c++/13310
* pt.c (dependent_template_p): Handle OVERLOADs.

PR c++/13310
* g++.dg/template/crash15.C: New test.

From-SVN: r74649

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

index 5e4e82433436ad61ba0e2592e1a1b73522e8b071..60bfd419ddfc2972f64ba7011962bab41fcc5caf 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-15  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/13310
+       * pt.c (dependent_template_p): Handle OVERLOADs.
+
 2003-12-15  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/13243
index 553d4f7d3183fd40448410f54b3eaa1ec3d8ca36..1a03bba6b89e261110e14c3a9d88ee3840ae28d3 100644 (file)
@@ -11912,6 +11912,17 @@ any_dependent_template_arguments_p (tree args)
 bool
 dependent_template_p (tree tmpl)
 {
+  if (TREE_CODE (tmpl) == OVERLOAD)
+    {
+      while (tmpl)
+       {
+         if (dependent_template_p (OVL_FUNCTION (tmpl)))
+           return true;
+         tmpl = OVL_CHAIN (tmpl);
+       }
+      return false;
+    }
+
   /* Template template parameters are dependent.  */
   if (DECL_TEMPLATE_TEMPLATE_PARM_P (tmpl)
       || TREE_CODE (tmpl) == TEMPLATE_TEMPLATE_PARM)
index 679637a3c04c79d9f2d838dada06fd0fa43737ac..941809d2c613d02a4df1fba2e489e9ad883d8781 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-15  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/13310
+       * g++.dg/template/crash15.C: New test.
+
 2003-12-15  Geoffrey Keating  <geoffk@apple.com>
 
        * g++.old-deja/g++.pt/vaarg3.C: Don't expect an error for passing
diff --git a/gcc/testsuite/g++.dg/template/crash15.C b/gcc/testsuite/g++.dg/template/crash15.C
new file mode 100644 (file)
index 0000000..e0aad73
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/13310
+
+struct A {};
+
+template <typename> void foo()
+{
+    A a;
+    a.foo<int>(); // { dg-error "" }
+}