aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2018-03-06 21:11:46 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2018-03-06 21:11:46 +0000
commit1dc23505191d6ac79af9d403e7c543addd760ebd (patch)
tree340e30c9dd00d90c29656bf58a339c40b6f6f53c /gcc/cp
parent849bbdb99c5c8b1a97041a533c69bbaf8376c975 (diff)
downloadgcc-1dc23505191d6ac79af9d403e7c543addd760ebd.zip
gcc-1dc23505191d6ac79af9d403e7c543addd760ebd.tar.gz
gcc-1dc23505191d6ac79af9d403e7c543addd760ebd.tar.bz2
re PR c++/84684 (inserting random code / flags produces wrong code)
PR c++/84684 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated arguments. * g++.dg/cpp1z/constexpr-84684.C: New test. From-SVN: r258303
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/constexpr.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bd2e104..ac7bd4b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/84684
+ * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
+ arguments.
+
2018-03-06 Alexandre Oliva <aoliva@redhat.com>
PR c++/84231
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 941562eb..bd53bfb 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1313,6 +1313,8 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
if (!*non_constant_p)
{
+ /* Don't share a CONSTRUCTOR that might be changed. */
+ arg = unshare_constructor (arg);
/* Make sure the binding has the same type as the parm. But
only for constant args. */
if (TREE_CODE (type) != REFERENCE_TYPE)