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<CXXRecordDecl>(RT->getDecl())) + FieldIndex += CXXRD->getNumBases(); ---------------- Do this before counting fields, IMO it's more intuitive. ================ Comment at: test/SemaCXX/designated-initializers-base-class.cpp:1 +// RUN: %clang_cc1 %s -std=c++1z -ast-dump | FileCheck %s + ---------------- This might be less fragile as an IRGen test. Alternatively, this is a good expected-no-diagnostic test: void test() { D d = {1, .y = 2}; } Right now we emit `warning: initializer overrides prior initialization of this subobject`, which is obviously wrong. https://reviews.llvm.org/D28705 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits