a literal type. Disallow it as the return type of a constexpr function
declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149469
91177308-0d34-0410-b5e6-
96231b3b80d8
assert(!T->isDependentType() && "type should not be dependent");
bool Incomplete = RequireCompleteType(Loc, T, 0);
- if (T->isLiteralType() || (AllowIncompleteType && Incomplete))
+ if (T->isLiteralType() ||
+ (AllowIncompleteType && Incomplete && !T->isVoidType()))
return false;
if (PD.getDiagID() == 0)
// - its return type shall be a literal type;
constexpr NonLiteral NonLiteralReturn(); // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}}
+ constexpr void VoidReturn(); // expected-error {{constexpr function's return type 'void' is not a literal type}}
constexpr ~T(); // expected-error {{destructor cannot be marked constexpr}}
typedef NonLiteral F();
constexpr F NonLiteralReturn2; // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}}