aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-10-23 16:57:05 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-10-23 16:57:05 -0400
commit73a842690d16120be06aa3d29f4bd0077375c04a (patch)
treeadf1f987ecdc8e9164586c34a2e56490e74012eb /gcc/cp/constexpr.c
parent0d6be0b10358ca2a8f26b2b9a1b63692731f7fbe (diff)
downloadgcc-73a842690d16120be06aa3d29f4bd0077375c04a.zip
gcc-73a842690d16120be06aa3d29f4bd0077375c04a.tar.gz
gcc-73a842690d16120be06aa3d29f4bd0077375c04a.tar.bz2
re PR c++/67813 ([C++14] copy-initialization of object with pointer member fails in constexpr function)
PR c++/67813 * constexpr.c (cxx_eval_store_expression): Always use *valp if set. From-SVN: r229270
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r--gcc/cp/constexpr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 3d682fd..ebca411 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2802,10 +2802,13 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
{
/* Create a new CONSTRUCTOR in case evaluation of the initializer
wants to modify it. */
- new_ctx.ctor = build_constructor (type, NULL);
if (*valp == NULL_TREE)
- *valp = new_ctx.ctor;
- CONSTRUCTOR_NO_IMPLICIT_ZERO (new_ctx.ctor) = no_zero_init;
+ {
+ *valp = new_ctx.ctor = build_constructor (type, NULL);
+ CONSTRUCTOR_NO_IMPLICIT_ZERO (new_ctx.ctor) = no_zero_init;
+ }
+ else
+ new_ctx.ctor = *valp;
new_ctx.object = target;
}