From d2dd85e389d58623142720da441167c2bd2375e8 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 12 Apr 2016 16:24:11 +0000 Subject: [PATCH] PR c++/70501 cp/ * constexpr.c (cxx_eval_bare_aggregate): Handle VECTOR_TYPE similarly to PMF. testsuite/ * g++.dg/init/pr70501.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234904 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/constexpr.c | 6 +++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/init/pr70501.C | 11 +++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/init/pr70501.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d1f1851d576..ee830a2e7e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-04-12 Nathan Sidwell + + PR c++/70501 + * constexpr.c (cxx_eval_bare_aggregate): Handle VECTOR_TYPE + similarly to PMF. + 2016-04-11 Jason Merrill * mangle.c (decl_is_template_id): The template itself counts as a diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index e6e2cf6ca5f..13f385b5a19 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2394,10 +2394,10 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t, tree type = TREE_TYPE (t); constexpr_ctx new_ctx; - if (TYPE_PTRMEMFUNC_P (type)) + if (TYPE_PTRMEMFUNC_P (type) || VECTOR_TYPE_P (type)) { - /* We don't really need the ctx->ctor business for a PMF, but it's - simpler to use the same code. */ + /* We don't really need the ctx->ctor business for a PMF or + vector, but it's simpler to use the same code. */ new_ctx = *ctx; new_ctx.ctor = build_constructor (type, NULL); new_ctx.object = NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64753aa4e32..1c2b5a76159 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-12 Nathan Sidwell + + PR c++/70501 + * g++.dg/init/pr70501.C: New. + 2016-04-12 David Wohlferd * gcc.target/i386/asm-flag-6.c: New test. diff --git a/gcc/testsuite/g++.dg/init/pr70501.C b/gcc/testsuite/g++.dg/init/pr70501.C new file mode 100644 index 00000000000..901b3c1b5a2 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/pr70501.C @@ -0,0 +1,11 @@ +/* { dg-options "" } Not pedantic */ + +typedef int v4si __attribute__ ((vector_size (16))); + +struct S { v4si v; }; + +void +fn2 (int i, int j) +{ + struct S s = { .v = i <= j + (v4si){(1, 2)} }; +} -- 2.11.4.GIT