PR c++/63924
* constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: A load
from a variable of empty class type is constant.
From-SVN: r217749
2014-11-18 Jason Merrill <jason@redhat.com>
+ PR c++/63924
+ * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: A load
+ from a variable of empty class type is constant.
+
* constexpr.c (cxx_eval_statement_list): Handle statement-expressions.
(potential_constant_expression_1): Handle STMT_EXPR.
r = *p;
else if (addr)
/* Defer in case this is only used for its type. */;
+ else if (is_empty_class (TREE_TYPE (t)))
+ {
+ /* If the class is empty, we aren't actually loading anything. */
+ r = build_constructor (TREE_TYPE (t), NULL);
+ TREE_CONSTANT (r) = true;
+ }
else
{
if (!ctx->quiet)
--- /dev/null
+// PR c++/63924
+// { dg-do compile { target c++11 } }
+
+struct A { };
+constexpr bool f(A a) { return true; }
+template <bool B> constexpr bool g() { return true; }
+constexpr bool g(A a) { return g<f(a)>(); }