tbaeder marked an inline comment as done.
tbaeder added inline comments.

================
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.
----------------
aaron.ballman wrote:
> Why the check for a record type?
For record types, the current error message would be:
```
default initialization of an object of const type 'const S3' without a 
user-provided default constructor
```
which gives more information than just "must be initialized by a constant 
expression".


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

Reply via email to