summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 01:44:06 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 01:44:06 +0000
commit01259852a07f0c379df3f0437f34fefd67115534 (patch)
tree440b64506e3a7030695a5e52c4a92863fbcb87a6
parent6192a37d4e894dfd4a0291acbb7a2aa50bbd6c50 (diff)
downloadgcc-01259852a07f0c379df3f0437f34fefd67115534.tar.gz
PR c++/61994
* init.c (build_vec_init): Leave atype an ARRAY_TYPE if we're just returning an INIT_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213688 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/init.c13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C13
3 files changed, 26 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 285f0585560..9ffd7468563 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,4 +1,10 @@
2014-08-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/61994
+ * init.c (build_vec_init): Leave atype an ARRAY_TYPE
+ if we're just returning an INIT_EXPR.
+
+2014-08-06 Jason Merrill <jason@redhat.com>
Braden Obrzut <admin@maniacsvault.net>
* pt.c (check_explicit_specialization): Don't test
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index eeee5bb3620..17e6c4becb5 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3840,6 +3840,13 @@ build_vec_init (tree base, tree maxindex, tree init,
stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
+ current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
+
+ if (errors)
+ return error_mark_node;
+ if (const_init)
+ return build2 (INIT_EXPR, atype, obase, const_init);
+
/* Now make the result have the correct type. */
if (TREE_CODE (atype) == ARRAY_TYPE)
{
@@ -3849,12 +3856,6 @@ build_vec_init (tree base, tree maxindex, tree init,
TREE_NO_WARNING (stmt_expr) = 1;
}
- current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
-
- if (const_init)
- return build2 (INIT_EXPR, atype, obase, const_init);
- if (errors)
- return error_mark_node;
return stmt_expr;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C
new file mode 100644
index 00000000000..8f74675f27b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C
@@ -0,0 +1,13 @@
+// PR c++/61994
+// { dg-do compile { target c++11 } }
+
+struct A { int i,j; };
+
+struct X {
+ A a = {1,1};
+};
+
+constexpr X table[1][1] = {{ {} }};
+
+#define SA(X) static_assert(X,#X)
+SA(table[0][0].a.i == 1);