aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-12-04 18:00:32 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-12-04 18:00:32 +0000
commit7b5d1e27361c3442fdf553f7384d68f3ce57fe8e (patch)
tree84d362165d7df88f2085057ef825f84b056d9687 /gcc/cp/call.c
parent7f575bf6d48e70be2184a4f7d19dd7c78c6f5113 (diff)
downloadgcc-7b5d1e27361c3442fdf553f7384d68f3ce57fe8e.zip
gcc-7b5d1e27361c3442fdf553f7384d68f3ce57fe8e.tar.gz
gcc-7b5d1e27361c3442fdf553f7384d68f3ce57fe8e.tar.bz2
re PR c++/29632 (ICE on invalid code: regenerate_decl_from_template, at cp/pt.c:10969)
PR c++/29632 * call.c (add_builtin_candidate): Do not permit NULL pointer constants to be compared with template parameters. PR c++/29632 * g++.dg/template/error23.C: New test. From-SVN: r119499
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index cfb566b..3418703 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1811,14 +1811,19 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
break;
if (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
break;
- if (TREE_CODE (type1) == ENUMERAL_TYPE && TREE_CODE (type2) == ENUMERAL_TYPE)
+ if (TREE_CODE (type1) == ENUMERAL_TYPE
+ && TREE_CODE (type2) == ENUMERAL_TYPE)
break;
- if (TYPE_PTR_P (type1) && null_ptr_cst_p (args[1]))
+ if (TYPE_PTR_P (type1)
+ && null_ptr_cst_p (args[1])
+ && !uses_template_parms (type1))
{
type2 = type1;
break;
}
- if (null_ptr_cst_p (args[0]) && TYPE_PTR_P (type2))
+ if (null_ptr_cst_p (args[0])
+ && TYPE_PTR_P (type2)
+ && !uses_template_parms (type2))
{
type1 = type2;
break;