re PR c++/21165 (bogus error on a user-defined conversion in a template)
cp: PR c++/21165 * init.c (integral_constant_value): Check the type of the initializer, not the decl. testsuite: PR c++/21165 * g++.dg/template/init5.C: New. From-SVN: r100402
This commit is contained in:
parent
fba53b18ab
commit
8bd46447b3
4 changed files with 23 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2005-05-31 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/21165
|
||||
* init.c (integral_constant_value): Check the type of the
|
||||
initializer, not the decl.
|
||||
|
||||
2005-05-30 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/21784
|
||||
|
|
|
@ -1573,7 +1573,7 @@ integral_constant_value (tree decl)
|
|||
&& DECL_INITIAL (decl)
|
||||
&& DECL_INITIAL (decl) != error_mark_node
|
||||
&& TREE_TYPE (DECL_INITIAL (decl))
|
||||
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
|
||||
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (DECL_INITIAL (decl))))
|
||||
decl = DECL_INITIAL (decl);
|
||||
return decl;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-05-31 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/21165
|
||||
* g++.dg/template/init5.C: New.
|
||||
|
||||
2005-05-31 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
* gfortran.dg/char_initialiser_actual.f90:
|
||||
|
|
11
gcc/testsuite/g++.dg/template/init5.C
Normal file
11
gcc/testsuite/g++.dg/template/init5.C
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 31 May 2005 <nathan@codesourcery.com>
|
||||
|
||||
// PR 21165. ICE on valid
|
||||
// Origin:Volker Reichelt reichelt@gcc.gnu.org
|
||||
|
||||
template<typename T> bool foo()
|
||||
{
|
||||
const int i = T();
|
||||
return i > 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue