[PATCH] D100057: Remove warning "suggest braces" for aggregate initialization of an empty class with an aggregate base class.
Hana Dusíková via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 7 14:01:16 PDT 2021
hankadusikova marked 3 inline comments as done.
hankadusikova added a comment.
In D100057#2675085 <https://reviews.llvm.org/D100057#2675085>, @jfb wrote:
> A few nits, but this is good otherwise!
Having an aggregate with multiple (empty) bases initialised with nonempty {} is a hard error, hence the 1.
https://compiler-explorer.com/z/hKqxWjo3G
================
Comment at: clang/lib/Sema/SemaInit.cpp:1018
+ if (CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(ParentRD)) {
+ if (CXXRD->getNumBases() == 1) {
+ return ParentRD->field_begin() == ParentRD->field_end();
----------------
jfb wrote:
> Multiple empty bases isn't a common thing, right? I don't think so, but would rather check.
Having an aggregate with multiple (empty) bases initialised with {} is a hard error, hence the 1.
https://compiler-explorer.com/z/hKqxWjo3G
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100057/new/
https://reviews.llvm.org/D100057
More information about the cfe-commits
mailing list