diff options
author | Jason Merrill <jason@redhat.com> | 2014-04-01 15:14:00 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-04-01 15:14:00 -0400 |
commit | 24991604f284ddfc6463152f5ae16fb3e6a27619 (patch) | |
tree | 87c76b1fdba8799f6c2f0c0358a6908c4d38a93e | |
parent | dd5593fc441c85171db5915982a1c4f53a9f025e (diff) | |
download | gcc-24991604f284ddfc6463152f5ae16fb3e6a27619.zip gcc-24991604f284ddfc6463152f5ae16fb3e6a27619.tar.gz gcc-24991604f284ddfc6463152f5ae16fb3e6a27619.tar.bz2 |
re PR c++/60708 (An array temporary causes an ICE in gimplify)
PR c++/60708
* call.c (build_array_conv): Call complete_type.
From-SVN: r208996
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/call.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist82.C | 20 |
3 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 453e2c5..2e6fd96 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-04-01 Jason Merrill <jason@redhat.com> + PR c++/60708 + * call.c (build_array_conv): Call complete_type. + PR c++/60713 * typeck2.c (PICFLAG_SIDE_EFFECTS): New. (picflag_from_initializer): Return it. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 877f6d9..ae0d4ff 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -948,6 +948,9 @@ build_array_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) bool user = false; enum conversion_rank rank = cr_exact; + /* We might need to propagate the size from the element to the array. */ + complete_type (type); + if (TYPE_DOMAIN (type) && !variably_modified_type_p (TYPE_DOMAIN (type), NULL_TREE)) { diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist82.C b/gcc/testsuite/g++.dg/cpp0x/initlist82.C new file mode 100644 index 0000000..3b9ccad --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist82.C @@ -0,0 +1,20 @@ +// PR c++/60708 +// { dg-do compile { target c++11 } } + +template <class T, class U> struct mypair { + mypair(T, U) {} +}; + +template<typename T> struct S { + mypair<T *, int> get_pair() noexcept { + return mypair<T*,int>(nullptr, 0); + } +}; + +static void foo(const mypair<char *, int> (&a)[2]) noexcept { } + +int main() +{ + S<char> s; + foo({s.get_pair(), s.get_pair()}); +} |