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:
Nathan Sidwell 2005-05-31 17:43:26 +00:00 committed by Nathan Sidwell
parent fba53b18ab
commit 8bd46447b3
4 changed files with 23 additions and 1 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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:

View 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;
}