rnk added a comment. Richard really is the constexpr owner so I'd like him to chime in if he can.
================ Comment at: include/clang/AST/Decl.h:1092 @@ -1091,3 +1091,3 @@ /// succeeded, 0 otherwise. - APValue *evaluateValue() const; - APValue *evaluateValue(SmallVectorImpl<PartialDiagnosticAt> &Notes) const; + APValue *evaluateValue(bool RespectMicrosoftABIIfNeeded = false) const; + APValue *evaluateValue(SmallVectorImpl<PartialDiagnosticAt> &Notes, ---------------- Maybe this parameter would be better named `IsStaticLocalInit` or something. ================ Comment at: include/clang/Basic/DiagnosticASTKinds.td:151 @@ -150,1 +150,3 @@ "%plural{1:byte|:bytes}1">; +def note_constexpr_microsoft_abi_declrefexpr : Note< + "in the Microsoft ABI static local variables cannot contain references to " ---------------- > One solution to this would be to create a variation of evaluateValue() which > activates this new behavior and only use it from > CodeGenModule::EmitConstantInit(), so that the behavior of evaluateValue() in > this context doesn't change. How does that sound? Right, only having this behavior change in the awkward static local case is good. > By the way, I just realized that > CheckPotentialExpressionContainingDeclRefExpr() eats this diagnostic because > of the SpeculativeLookForDeclRefExprRAII object. Should I propagate it up > from CheckPotentialExpressionContainingDeclRefExpr() to make it user visible? > Right now the test case above only emits "constexpr variable 'p' must be > initialized by a constant expression" without any notes. Yeah, I'd like it if we could get that note out. I'm surprised we can't use the normal recursive traversal to find the DeclRefExprs... http://reviews.llvm.org/D16465 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits