diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-05-06 20:40:23 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-05-06 20:40:23 +0000 |
commit | b166a559ed96aaf211a6f952d60703c8c6325161 (patch) | |
tree | bbc1f1363670e847670f639111273c826d710777 /gcc | |
parent | 75bfa67836449ebe29c760185ccae8ce070a4e9c (diff) | |
download | gcc-b166a559ed96aaf211a6f952d60703c8c6325161.zip gcc-b166a559ed96aaf211a6f952d60703c8c6325161.tar.gz gcc-b166a559ed96aaf211a6f952d60703c8c6325161.tar.bz2 |
re PR c++/27427 (ICE with invalid template parameter)
PR c++/27427
* pt.c (convert_nontype_argument): Return early on invalid arguments.
* g++.dg/template/incomplete2.C: New test.
From-SVN: r113582
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/incomplete2.C | 13 |
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4f460a3..5035ded 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. + * pt.c (process_template_parm): Remove superfluous temporary. PR c++/27430 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c7d94f1..4d34da4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3457,6 +3457,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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e6e725..63e3869 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-05-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/27427 + * g++.dg/template/incomplete2.C: New test. + 2006-05-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/27151 diff --git a/gcc/testsuite/g++.dg/template/incomplete2.C b/gcc/testsuite/g++.dg/template/incomplete2.C new file mode 100644 index 0000000..23d393e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/incomplete2.C @@ -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" } +} |