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
This commit is contained in:
parent
7f575bf6d4
commit
7b5d1e2736
4 changed files with 36 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-12-04 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/29632
|
||||
* call.c (add_builtin_candidate): Do not permit NULL pointer
|
||||
constants to be compared with template parameters.
|
||||
|
||||
2006-12-04 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* pt.c (for_each_template_parm_r) <INTEGER_TYPE>: New case.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2006-12-04 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/29632
|
||||
* g++.dg/template/error23.C: New test.
|
||||
|
||||
2006-12-04 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* gcc.target/i386/sse-18.c: Pass if CPU has no SSE2 support.
|
||||
|
|
17
gcc/testsuite/g++.dg/template/error23.C
Normal file
17
gcc/testsuite/g++.dg/template/error23.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
// PR c++/29632
|
||||
|
||||
struct nullptr_type {
|
||||
|
||||
nullptr_type ( void ) {}
|
||||
|
||||
template < typename T >
|
||||
operator T* ( void ) const {
|
||||
return ( 0 );
|
||||
}
|
||||
} const nullptr;
|
||||
|
||||
int main ( void ) {
|
||||
0 == nullptr; // { dg-error "match" }
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue