diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-05-07 01:07:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-05-07 01:07:30 +0000 |
commit | d079abfb5eefaf7da232e39a6564f561402cf4fe (patch) | |
tree | e63d342c8c400c0b7a35eb50620c6348cbb75e81 /lib/Sema/SemaInit.cpp | |
parent | 3127d48cd8572d88d16e2b2d16045bdb3f7a4a98 (diff) |
A union can have a constexpr defaulted default constructor, if it has an
in-class initializer for one of its fields. Value-initialization of such
a type should use the in-class initializer!
The former was just a bug, the latter is a (reported) standard defect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 0ef1b1e81f..66cc1e14e5 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3642,11 +3642,10 @@ static void TryValueInitialization(Sema &S, // user-provided or deleted default constructor, then the object is // zero-initialized and, if T has a non-trivial default constructor, // default-initialized; - if ((ClassDecl->getTagKind() == TTK_Class || - ClassDecl->getTagKind() == TTK_Struct)) { - Sequence.AddZeroInitializationStep(Entity.getType()); - return TryConstructorInitialization(S, Entity, Kind, 0, 0, T, Sequence); - } + // FIXME: The 'non-union' here is a defect (not yet assigned an issue + // number). Update the quotation when the defect is resolved. + Sequence.AddZeroInitializationStep(Entity.getType()); + return TryConstructorInitialization(S, Entity, Kind, 0, 0, T, Sequence); } } |