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
This commit is contained in:
Jakub Jelinek 2011-12-07 20:51:54 +01:00 committed by Jakub Jelinek
parent 95c0a8a714
commit 14b1860e4e
4 changed files with 25 additions and 1 deletions

View file

@ -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

View file

@ -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))
{

View file

@ -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

View file

@ -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];
}