From 14e51ef29345191a67a212ecccd79fa426826a64 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 1 Apr 2015 13:08:05 +0000 Subject: [PATCH] re PR middle-end/65554 (ICE: verify_gimple failed) PR c++/65554 * class.c (finish_struct): Require that the second field of a user-defined initializer_list be of size type. * g++.dg/cpp0x/initlist93.C: New test. * g++.dg/cpp0x/initlist94.C: New test. From-SVN: r221808 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/class.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/initlist93.C | 13 +++++++++++++ gcc/testsuite/g++.dg/cpp0x/initlist94.C | 13 +++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist93.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist94.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0d2456d6eb8..946450b48b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-04-01 Marek Polacek + + PR c++/65554 + * class.c (finish_struct): Require that the second field of a + user-defined initializer_list be of size type. + 2015-03-31 Marek Polacek PR c++/65390 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c2d420190c4..9f189fb5eaf 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6891,7 +6891,7 @@ finish_struct (tree t, tree attributes) if (f && TREE_CODE (TREE_TYPE (f)) == POINTER_TYPE) { f = next_initializable_field (DECL_CHAIN (f)); - if (f && TREE_CODE (TREE_TYPE (f)) == INTEGER_TYPE) + if (f && same_type_p (TREE_TYPE (f), size_type_node)) ok = true; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24fbed7c7bd..399f9ccad37 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-04-01 Marek Polacek + + PR c++/65554 + * g++.dg/cpp0x/initlist93.C: New test. + * g++.dg/cpp0x/initlist94.C: New test. + 2015-04-01 Max Ostapenko PR target/65624 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist93.C b/gcc/testsuite/g++.dg/cpp0x/initlist93.C new file mode 100644 index 00000000000..84a47381f18 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist93.C @@ -0,0 +1,13 @@ +// PR c++/65554 +// { dg-do compile { target c++11 } } + +namespace std +{ +template class initializer_list // { dg-error "definition of std::initializer_list does not match" } +{ + int *_M_array; + int _M_len; +}; +} + +// { dg-prune-output "compilation terminated" } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist94.C b/gcc/testsuite/g++.dg/cpp0x/initlist94.C new file mode 100644 index 00000000000..f83a81d3a45 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist94.C @@ -0,0 +1,13 @@ +// PR c++/65554 +// { dg-do compile { target c++11 } } + +typedef decltype (sizeof (int)) size_type; + +namespace std +{ +template class initializer_list +{ + int *_M_array; + size_type _M_len; +}; +} -- 2.30.2