diff options
-rw-r--r-- | lib/Sema/SemaType.cpp | 3 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 280a60e5de..684f355bfb 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -4212,7 +4212,8 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, 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) diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp index 6e4e5803d1..19bcde6640 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp @@ -40,6 +40,7 @@ struct T : SS, NonLiteral { // expected-note {{base class 'NonLiteral' of non-li // - 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}} |