commit b0f1533a6e7981e5ae12809a60f7b4a96221ff13
Author: Jason Merrill <jason@redhat.com>
Date: Fri Dec 7 10:42:01 2012 -0500
PR c++/55419
* tree.c (build_target_expr): Don't set TREE_CONSTANT.
@@ -329,8 +329,6 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain)
side-effects, then the optimizer should be able to get rid of
whatever code is generated anyhow. */
TREE_SIDE_EFFECTS (t) = 1;
- if (literal_type_p (type))
- TREE_CONSTANT (t) = TREE_CONSTANT (value);
return t;
}
new file mode 100644
@@ -0,0 +1,27 @@
+// PR c++/55419
+// { dg-options -std=c++11 }
+
+struct P
+{
+ P () = default;
+ explicit constexpr P (int x) : p (x) {}
+ int p;
+};
+
+struct Q
+{
+ constexpr Q () : q (0x7f) {}
+ int q;
+};
+
+struct R
+{
+ Q q;
+ P p;
+};
+
+void
+foo (R *x)
+{
+ *x = {};
+}