[PATCH] D22662: [cxx1z-constexpr-lambda] Make a lambda's closure type a literal type in C++1z.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 21 23:48:48 PDT 2016
rsmith added a comment.
Everything other than the diagnostics change LGTM; can we handle the diagnostics change as a central patch and put this fallback logic directly into the diagnostics formatting code, so it applies everywhere we try to print the name of an unnamed class?
================
Comment at: lib/Sema/SemaType.cpp:7168-7176
@@ -7167,3 +7167,11 @@
!RD->hasTrivialDefaultConstructor()) {
- Diag(RD->getLocation(), diag::note_non_literal_no_constexpr_ctors) << RD;
+ // If the class does not have a name (for e.g. a lambda's closure class) use
+ // its type which we should know how to pretty-print, otherwise use the
+ // class's name.
+ auto &&DiagBuilder =
+ Diag(RD->getLocation(), diag::note_non_literal_no_constexpr_ctors);
+ if (!RD->getIdentifier())
+ DiagBuilder << Context.getRecordType(RD);
+ else
+ DiagBuilder << RD;
} else if (RD->hasNonLiteralTypeFieldsOrBases()) {
----------------
This seems like something that would be better handled centrally by the diagnostics machinery.
https://reviews.llvm.org/D22662
More information about the cfe-commits
mailing list