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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to