[PATCH] D18510: [cxx1z-constexpr-lambda] Make conversion function constexpr
Faisal Vali via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 27 22:22:39 PDT 2016
faisalv created this revision.
faisalv added a reviewer: rsmith.
faisalv added a subscriber: cfe-commits.
Mark the lambda's conversion to function-pointer as incontrovertibly constexpr.
auto L = [](auto a) { return a; };
constexpr int* (*fp)(int*) = L; // This is now allowed.
By itself this is not terribly useful. A subsequent patch will enable a call through the function pointer in a constant expression if the lambda's synthesized call operator is constexpr.
The more interesting/controversial aspect of the patch (and the part I really need feedback on) is emission of a warning if this is called in pre-c++1z constant expressions, and making sure such warnings are ignored when determining if the constant expression evaluation succeeded. Look forward to your feedback...
http://reviews.llvm.org/D18510
Files:
include/clang/AST/ASTContext.h
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/ASTContext.cpp
lib/AST/Decl.cpp
lib/AST/ExprConstant.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaLambda.cpp
test/SemaCXX/cxx1z-constexpr-lambdas.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18510.51770.patch
Type: text/x-patch
Size: 9229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160328/e2684569/attachment.bin>
More information about the cfe-commits
mailing list