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 through aggregate initialization (and therefore it doesn't enter CheckDesignatedInitializer). Instead, in TryListInitialization, it tries to find a matching constructor of D and fails. ================ Comment at: test/SemaCXX/designated-initializers-base-class.cpp:1 +// RUN: %clang_cc1 %s -std=c++1z -ast-dump | FileCheck %s + ---------------- rnk wrote: > 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. good idea. https://reviews.llvm.org/D28705 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits