]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/27427 (ICE with invalid template parameter)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Sat, 6 May 2006 20:45:59 +0000 (20:45 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sat, 6 May 2006 20:45:59 +0000 (20:45 +0000)
PR c++/27427
* pt.c (convert_nontype_argument): Return early on invalid arguments.

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

From-SVN: r113584

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

index b3467f52f15dc74ac2a037ddbaccbcc7650ff991..97abb1a69c67cb02f6dfa4b5c4607c6cf10cfa8e 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27427
+       * pt.c (convert_nontype_argument): Return early on invalid arguments.
+
        PR c++/27422
        * typeck.c (convert_arguments): Return early on args with
        invalid types.
index ea2b150e49cd1a95fb3538e9423e61e7bc6995fc..8277fc5972fecbaf68f447c599367ab2aec29e6e 100644 (file)
@@ -3426,6 +3426,8 @@ convert_nontype_argument (tree type, tree expr)
      instantiated -- but here we need the resolved form so that we can
      convert the argument.  */
   expr = fold_non_dependent_expr (expr);
+  if (error_operand_p (expr))
+    return error_mark_node;
   expr_type = TREE_TYPE (expr);
 
   /* HACK: Due to double coercion, we can get a
index f2c20ddd4a3e2b4b6c3a13a4cb21393e137208b7..154e72aa51c6e177c1da64f3cde478aa0e16f82c 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27427
+       * g++.dg/template/incomplete2.C: New test.
+
        PR c++/27422
        * g++.dg/conversion/void1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/incomplete2.C b/gcc/testsuite/g++.dg/template/incomplete2.C
new file mode 100644 (file)
index 0000000..23d393e
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/27427
+// { dg-do compile }
+
+struct A;
+
+template<A&> void foo();
+
+A a;  // { dg-error "incomplete type" }
+
+void bar()
+{
+  foo<a>();  // { dg-error "no matching function" }
+}