diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-12-07 20:51:54 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-12-07 20:51:54 +0100 |
commit | 14b1860e4e982d27e6669621c105e72d6c8bff41 (patch) | |
tree | 10604cc49462f6f8823fc29993572ed90a7eb37b | |
parent | 95c0a8a714efb1be55f3bb2af190db003d6455dc (diff) | |
download | gcc-14b1860e4e982d27e6669621c105e72d6c8bff41.zip gcc-14b1860e4e982d27e6669621c105e72d6c8bff41.tar.gz gcc-14b1860e4e982d27e6669621c105e72d6c8bff41.tar.bz2 |
re PR c++/51369 ([c++0x] [4.7 Regression] ICE using constexpr in template)
PR c++/51369
* init.c (build_value_init): Allow array types even when
processing_template_decl.
* g++.dg/cpp0x/constexpr-51369.C: New test.
From-SVN: r182086
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C | 12 |
4 files changed, 25 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 71a707e..76bd0af 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-12-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/51369 + * init.c (build_value_init): Allow array types even when + processing_template_decl. + 2011-12-07 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/51420 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index e1eb681..e93e82c 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -333,7 +333,8 @@ build_value_init (tree type, tsubst_flags_t complain) constructor. */ /* The AGGR_INIT_EXPR tweaking below breaks in templates. */ - gcc_assert (!processing_template_decl || SCALAR_TYPE_P (type)); + gcc_assert (!processing_template_decl + || (SCALAR_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)); if (CLASS_TYPE_P (type)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04d6c23..1a4a182 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/51369 + * g++.dg/cpp0x/constexpr-51369.C: New test. + 2011-12-07 Andrew Pinski <apinski@cavium.com> PR middle-end/45416 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C new file mode 100644 index 0000000..6606be8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C @@ -0,0 +1,12 @@ +// PR c++/51369 +// { dg-do compile } +// { dg-options "-std=c++11" } + +constexpr int x[2][2] = {}; + +template<int> +void +foo () +{ + x[0][0]; +} |