aaron.ballman added a comment. Thanks for working on this, I like the direction it's heading! One question I'm kicking around my head is, should we do something similar for `const` variables?
const int i; // error: default initialization of an object of const type 'const int' it sure seems like this could be similarly improved to say something along the lines of `error: variable 'i' of const type must be initialized` Also, don't forget to add a release note. ================ Comment at: clang/lib/Sema/SemaFixItUtils.cpp:208-210 + if (T->isArrayType()) { + return " = {}"; + } ---------------- I don't think this is a good change, consider: ``` int array[] = {}; ``` zero-sized arrays are an extension in both C and C++, and the empty initializer is a GNU extension in C (at least until C2x). ================ Comment at: clang/lib/Sema/SemaInit.cpp:8063 // handled in the Failed() branch above. - QualType DestType = Entity.getType(); - S.Diag(Kind.getLocation(), DiagID) - << DestType << (bool)DestType->getAs<RecordType>() - << FixItHint::CreateInsertion(ZeroInitializationFixitLoc, - ZeroInitializationFixit); + if (!DestType->getAs<RecordType>() && VD && VD->isConstexpr()) { + // Use a more useful diagnostic for constexpr variables. ---------------- Why the check for a record type? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131662/new/ https://reviews.llvm.org/D131662 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits