aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-01-14 08:08:11 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-01-14 08:08:11 -0500
commit35385f991f052ff58476c64ed62b09751e55e31a (patch)
tree1c7140028698b92aff84b7eb991275a3479cb718 /gcc
parent70f961a51eed84328a6c2226d4a72f90801ca3b5 (diff)
downloadgcc-35385f991f052ff58476c64ed62b09751e55e31a.zip
gcc-35385f991f052ff58476c64ed62b09751e55e31a.tar.gz
gcc-35385f991f052ff58476c64ed62b09751e55e31a.tar.bz2
re PR c++/46903 ([C++0x] ICE unexpected expression of kind template_id_expr)
PR c++/46903 * typeck2.c (check_narrowing): Only check arithmetic types. From-SVN: r168783
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck2.c3
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C10
4 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d841686..428ec29b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-01-14 Jason Merrill <jason@redhat.com>
+ PR c++/46903
+ * typeck2.c (check_narrowing): Only check arithmetic types.
+
PR c++/46688
* tree.c (build_vec_init_expr): Handle flexible array
properly.
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 3d65939..82218f0 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -717,6 +717,9 @@ check_narrowing (tree type, tree init)
bool ok = true;
REAL_VALUE_TYPE d;
+ if (!ARITHMETIC_TYPE_P (type))
+ return;
+
init = maybe_constant_value (init);
if (TREE_CODE (type) == INTEGER_TYPE
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9851be4..fa8f110 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2011-01-14 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/constexpr-regress1.C: New.
+
* g++.dg/ext/flexary2.C: New.
2011-01-14 Richard Guenther <rguenther@suse.de>
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C
new file mode 100644
index 0000000..a6fe399
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-regress1.C
@@ -0,0 +1,10 @@
+// PR c++/46903
+// This isn't C++0x code, but it was breaking in C++0x mode.
+// { dg-options -std=c++0x }
+
+struct A {};
+struct B {
+ void *(*a)();
+};
+template <typename T> void *CreateA() {}
+B b = {CreateA<A>};