This revision was automatically updated to reflect the committed changes.
Closed by commit rL292245: [Sema] Fix bug in handling of designated
initializer. (authored by ahatanak).
Changed prior to commit:
https://reviews.llvm.org/D28705?vs=84418&id=84714#toc
Repository:
rL LLVM
https://revie
rnk accepted this revision.
rnk added a comment.
lgtm
https://reviews.llvm.org/D28705
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.
LGTM
https://reviews.llvm.org/D28705
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/c
ahatanak added a comment.
In https://reviews.llvm.org/D28705#646088, @rnk wrote:
> What happens with virtual bases?
>
> struct B { int x; };
> struct D : virtual B { int y; };
> void test() { D d = {1, .y = 2}; }
A class with virtual base is not considered an aggregate, so it doesn't go
ahatanak updated this revision to Diff 84418.
ahatanak marked 2 inline comments as done.
ahatanak added a comment.
Address review comments.
https://reviews.llvm.org/D28705
Files:
lib/Sema/SemaInit.cpp
test/SemaCXX/designated-initializers-base-class.cpp
Index: test/SemaCXX/designated-initi
rnk added a comment.
What happens with virtual bases?
struct B { int x; };
struct D : virtual B { int y; };
void test() { D d = {1, .y = 2}; }
Comment at: lib/Sema/SemaInit.cpp:2250
+if (auto *CXXRD = dyn_cast(RT->getDecl()))
+ FieldIndex += CXXRD->getNumBases
ahatanak created this revision.
ahatanak added reviewers: rsmith, rnk, arphaman.
ahatanak added a subscriber: cfe-commits.
CheckDesignatedInitializer wasn't taking into account the base classes when
computing the index for the field in the derived class, which caused the test
case to crash durin