[PATCH] D24371: Add diagnostics to require_constant_initialization

Keno Fischer via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 13:07:34 PDT 2016

loladiro added inline comments.

Comment at: lib/Sema/SemaDecl.cpp:10535-10538
@@ -10534,1 +10534,6 @@
           << attr->getRange();
+        APValue Value;
+        SmallVector<PartialDiagnosticAt, 8> Notes;
+        cast<Expr>(var->ensureEvaluatedStmt()->Value)->EvaluateAsInitializer(
+          Value, getASTContext(), var, Notes);
+        for (auto &it : Notes)
rsmith wrote:
> Can you capture the diagnostics from `checkInitIsICE` instead of recomputing them here? (It looks straightforward to add an overload that takes a vector of notes.) In the non-C++11 case, you can produce a note pointing to `CacheCulprit` instead.
The problem is that the result of checking is cached internally and the diagnostics are only produced the first time. I don't think it's necessarily guaranteed that the above `checkInitIsICE` is the first such call (unless you can see such a reason). 



More information about the cfe-commits mailing list