* constexpr.c (potential_constant_expression_1): Check
TARGET_EXPR_DIRECT_INIT_P.
From-SVN: r256860
+2018-01-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/82461 - constexpr list-initialized member
+ * constexpr.c (potential_constant_expression_1): Check
+ TARGET_EXPR_DIRECT_INIT_P.
+
2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81013
return RECUR (TREE_OPERAND (t, 1), want_rval);
case TARGET_EXPR:
- if (!literal_type_p (TREE_TYPE (t)))
+ if (!TARGET_EXPR_DIRECT_INIT_P (t)
+ && !literal_type_p (TREE_TYPE (t)))
{
if (flags & tf_error)
{
--- /dev/null
+// PR c++/82461
+// { dg-do compile { target c++11 } }
+
+class A {
+private:
+public:
+ constexpr A() {}
+ ~A() {}
+};
+
+class B {
+private:
+ A a;
+public:
+ constexpr B() : a{} {}
+// works
+// constexpr B() : a() {}
+
+ ~B() {}
+};