[PATCH] D24371: Add diagnostics to require_constant_initialization
Keno Fischer via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 8 20:03:39 PDT 2016
loladiro created this revision.
loladiro added reviewers: EricWF, aaron.ballman, rsmith.
loladiro added a subscriber: cfe-commits.
loladiro set the repository for this revision to rL LLVM.
This hooks up the detailed diagnostics why constant initialization was not possible if require_constant_initialization reports an error. I have updated the test to account for the new notes.
Everything works fine, except that in C++11 mode we get:
error: 'note' diagnostics expected but not seen:
File /data/llvm/tools/clang/test/SemaCXX/attr-require-constant-initialization.cpp Line 229 (directive at /data/llvm/tools/clang/test/SemaCXX/attr-require-constant-initialization.cpp:231): non-constexpr constructor 'NonLit' cannot be used in a constant expression
error: 'note' diagnostics seen but not expected:
(frontend): non-literal type 'NonLit' cannot be used in a constant expression
This is because of an ImplicitValueInitExpr that gets passed into CheckLiteralType, but since ImplicitValueInitExpr doesn't have source information we get an invalid source location. I'm not really sure how to fix that (Is it possible to test for a note without source location?). Adding the proper source locations to ImplicitValueInitExpr seemed like a bigger undertaking than was warranted for this patch, so I'd appreciate guidance on how to proceed.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 9749 bytes
Desc: not available
More information about the cfe-commits