aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-05-31 17:43:26 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2005-05-31 17:43:26 +0000
commit8bd46447b3669450cb22678ae1b226d3c3aba576 (patch)
tree03394e83db81a65eb8ed9555e2c58af853374744 /gcc
parentfba53b18ab956e028e1a710f0029404408888c43 (diff)
downloadgcc-8bd46447b3669450cb22678ae1b226d3c3aba576.zip
gcc-8bd46447b3669450cb22678ae1b226d3c3aba576.tar.gz
gcc-8bd46447b3669450cb22678ae1b226d3c3aba576.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/init5.C11
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ae4aca7..36f72df 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 99891cb..7c8d9c6 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 57f8f91..3d27673 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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:
diff --git a/gcc/testsuite/g++.dg/template/init5.C b/gcc/testsuite/g++.dg/template/init5.C
new file mode 100644
index 0000000..ab529be
--- /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 <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;
+}