Commit d3a9902e by Jason Merrill Committed by Jason Merrill

PR c++/82461 - constexpr list-initialized member

	* constexpr.c (potential_constant_expression_1): Check
	TARGET_EXPR_DIRECT_INIT_P.

From-SVN: r256860
parent dac867c9
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
......
......@@ -5726,7 +5726,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
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)
{
......
// 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() {}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment