]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/24671 (ICE with zero-sized arrays)
authorMark Mitchell <mark@codesourcery.com>
Fri, 23 Dec 2005 23:16:12 +0000 (23:16 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 23 Dec 2005 23:16:12 +0000 (23:16 +0000)
PR c++/24671
* pt.c (instantiate_template): Handle SFINAE.
PR c++/24671
* g++.dg/template/sfinae3.C: New test.

From-SVN: r109022

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

index 6a6090a8af8b8a7617a6b3f7eeddd81d14dd4c67..1279a44ebb6c3605f8e46ba2fc78fdf000939e11 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24671
+       * pt.c (instantiate_template): Handle SFINAE.
+
 2005-12-23  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * decl.c (grokdeclarator): Improve diagnostic for friend
index 93dad098689546e4ece0ca306a66f29ccbea26d6..5b025ce7ff44a70a4397c133293907a0a68c61b4 100644 (file)
@@ -9149,6 +9149,8 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
   /* Substitute template parameters.  */
   fndecl = tsubst (DECL_TEMPLATE_RESULT (gen_tmpl),
                   targ_ptr, complain, gen_tmpl);
+  if (fndecl == error_mark_node)
+    return error_mark_node;
 
   /* Now we know the specialization, compute access previously
      deferred.  */
index 3265ba5168c3d1ab064ff5f8cf2905c9dfb08932..fd0d33366078165e8e714fa8e1fd8c6773783e53 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24671
+       * g++.dg/template/sfinae3.C: New test.
+
 2005-12-23  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * g++.dg/other/friend4.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/sfinae3.C b/gcc/testsuite/g++.dg/template/sfinae3.C
new file mode 100644 (file)
index 0000000..8d141ea
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/24671
+// { dg-options "" }
+
+template<typename> struct A
+{
+  typedef int X;
+  static const int i = 0;
+};
+
+template<typename> struct B
+{
+  B(const B&); // { dg-error "candidate" }
+  typedef typename A<char[A<B>::i]>::X Y;
+  template<typename T> B(T, Y); // { dg-error "call" }
+};
+
+B<int> b(0,0);