diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae4aca71f5f..36f72dfc998 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-05-31 Nathan Sidwell + + PR c++/21165 + * init.c (integral_constant_value): Check the type of the + initializer, not the decl. + 2005-05-30 Mark Mitchell PR c++/21784 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 99891cb2922..7c8d9c6a800 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57f8f913c02..3d27673835d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-05-31 Nathan Sidwell + + PR c++/21165 + * g++.dg/template/init5.C: New. + 2005-05-31 Paul Thomas * gfortran.dg/char_initialiser_actual.f90: diff --git a/gcc/testsuite/g++.dg/template/init5.C b/gcc/testsuite/g++.dg/template/init5.C new file mode 100644 index 00000000000..ab529beb98f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/init5.C @@ -0,0 +1,11 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 31 May 2005 + +// PR 21165. ICE on valid +// Origin:Volker Reichelt reichelt@gcc.gnu.org + +template bool foo() +{ + const int i = T(); + return i > 0; +}