non-literal class type.
llvm-svn: 210696
if (Object->getType()->isLiteralType(Info.Ctx))
return EvaluateTemporary(Object, This, Info);
+ Info.Diag(Object, diag::note_constexpr_nonliteral) << Object->getType();
return false;
}
constexpr R F() const { return 0; }
};
constexpr int d = ConstexprMember<int>().F(); // ok
-constexpr int e = ConstexprMember<NonLiteral>().F(); // expected-error {{constant expression}}
+constexpr int e = ConstexprMember<NonLiteral>().F(); // expected-error {{constant expression}} expected-note {{non-literal type 'const NonLiteral' cannot be used in a constant expression}}
template<typename ...P> struct ConstexprCtor {
constexpr ConstexprCtor(P...) {}
constexpr bool b(int n) { return &n; }
static_assert(b(0), "");
+struct NonLiteral {
+ NonLiteral();
+ int f();
+};
+constexpr int k = NonLiteral().f(); // expected-error {{constant expression}} expected-note {{non-literal type 'Temporaries::NonLiteral'}}
+
}
namespace Union {