* constexpr.c (cxx_eval_constant_expression): Check
COMPLETE_TYPE_P before calling is_really_empty_class.
* class.c (is_really_empty_class): Don't call complete_type.
From-SVN: r239289
2016-08-09 Jason Merrill <jason@redhat.com>
+ PR c++/72849
+ * constexpr.c (cxx_eval_constant_expression): Check
+ COMPLETE_TYPE_P before calling is_really_empty_class.
+ * class.c (is_really_empty_class): Don't call complete_type.
+
PR c++/56701
* typeck.c (cp_build_addr_expr_1): Remove special *this handling.
/* CLASSTYPE_EMPTY_P isn't set properly until the class is actually laid
out, but we'd like to be able to check this before then. */
- if (COMPLETE_TYPE_P (complete_type (type)) && is_empty_class (type))
+ if (COMPLETE_TYPE_P (type) && is_empty_class (type))
return true;
for (binfo = TYPE_BINFO (type), i = 0;
CONST_DECL for aggregate constants. */
if (lval)
return t;
- if (is_really_empty_class (TREE_TYPE (t)))
+ if (COMPLETE_TYPE_P (TREE_TYPE (t))
+ && is_really_empty_class (TREE_TYPE (t)))
{
/* If the class is empty, we aren't actually loading anything. */
r = build_constructor (TREE_TYPE (t), NULL);
--- /dev/null
+// PR c++/72849
+
+extern struct Foo a;
+template <typename> void fn1() { a; }