diff options
author | Jason Merrill <jason@redhat.com> | 2016-02-15 16:13:57 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-02-15 16:13:57 -0500 |
commit | fe69277d6650978749d17d11f488230cee1b2ad9 (patch) | |
tree | 1cf38322adae7394bf1e4d5076e2347e5179807c /gcc | |
parent | e8444ca6f85c1931c341e1d3f340edd8782a8f9a (diff) | |
download | gcc-fe69277d6650978749d17d11f488230cee1b2ad9.zip gcc-fe69277d6650978749d17d11f488230cee1b2ad9.tar.gz gcc-fe69277d6650978749d17d11f488230cee1b2ad9.tar.bz2 |
re PR c++/68890 (ICE in verify_ctor_sanity, at cp/constexpr.c:2113)
PR c++/68890
* constexpr.c (verify_ctor_sanity): Remove CONSTRUCTOR_NELTS check.
From-SVN: r233430
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-value5.C | 18 |
3 files changed, 25 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3f2177f..85473df 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-02-15 Jason Merrill <jason@redhat.com> + + PR c++/68890 + * constexpr.c (verify_ctor_sanity): Remove CONSTRUCTOR_NELTS check. + 2016-02-12 Patrick Palka <ppalka@gcc.gnu.org> PR c++/69098 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 85fc64e..11037fb 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2202,7 +2202,8 @@ verify_ctor_sanity (const constexpr_ctx *ctx, tree type) gcc_assert (ctx->ctor); gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (ctx->ctor))); - gcc_assert (CONSTRUCTOR_NELTS (ctx->ctor) == 0); + /* We used to check that ctx->ctor was empty, but that isn't the case when + the object is zero-initialized before calling the constructor. */ if (ctx->object) gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (ctx->object))); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-value5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-value5.C new file mode 100644 index 0000000..8928b67 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-value5.C @@ -0,0 +1,18 @@ +// PR c++/68890 +// { dg-do compile { target c++11 } } + +class ptr; +template <long _Nm> struct A { typedef ptr _Type[_Nm]; }; +template <long _Nm> struct B { typename A<_Nm>::_Type _M_elems; }; +template <long N> class FixedVector : B<N> { +public: + typedef B<1> base; + constexpr FixedVector() : base(), size_() {} + char size_; +}; +class ptr { +public: + constexpr ptr() : px_(){}; + int px_; +}; +FixedVector<1> a; |