Commit 6a0cc1cd by Jason Merrill Committed by Jason Merrill

re PR c++/67364 ("accessing uninitialized member" error in constexpr context)

	PR c++/67364
	* constexpr.c (cxx_eval_component_reference): Don't complain about
	unevaluated empty classes.

From-SVN: r233716
parent 6284a979
2016-02-25 Jason Merrill <jason@redhat.com>
PR c++/67364
* constexpr.c (cxx_eval_component_reference): Don't complain about
unevaluated empty classes.
PR c++/68049
* tree.c (strip_typedefs): Use DECL_ORIGINAL_TYPE.
......
......@@ -1983,7 +1983,8 @@ cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
return t;
}
if (CONSTRUCTOR_NO_IMPLICIT_ZERO (whole))
if (CONSTRUCTOR_NO_IMPLICIT_ZERO (whole)
&& !is_empty_class (TREE_TYPE (part)))
{
/* 'whole' is part of the aggregate initializer we're currently
building; if there's no initializer for this member yet, that's an
......
// PR c++/67364
// { dg-do compile { target c++11 } }
template <typename Xn>
struct element : Xn {
constexpr element() : Xn() { }
};
template <typename Xn>
struct closure {
element<Xn> member;
constexpr closure() { }
};
struct empty { };
constexpr closure<empty> tup{};
constexpr empty first = tup.member;
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