aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorDaniel M. Katz <katzdm@gmail.com>2024-04-25 03:41:25 -0400
committerGitHub <noreply@github.com>2024-04-25 09:41:25 +0200
commit5e767bd7d16dcdfc1ad8b32ba399f969dd940f57 (patch)
tree2db9fe63b65404030c9c2340477d20909063bd59 /clang/lib/Frontend/ASTUnit.cpp
parent08949464ac4de9bac2a415fb3c0963060936ec17 (diff)
downloadllvm-5e767bd7d16dcdfc1ad8b32ba399f969dd940f57.zip
llvm-5e767bd7d16dcdfc1ad8b32ba399f969dd940f57.tar.gz
llvm-5e767bd7d16dcdfc1ad8b32ba399f969dd940f57.tar.bz2
Push immediate function context while transforming lambdas in templates. (#89702)
The following program is [accepted](https://godbolt.org/z/oEc34Trh4) by Clang, EDG, and MSVC, but rejected by Clang: ```cpp #include <vector> consteval auto fn() { return std::vector {1,2,3}; } template <typename T = int> void fn2() { (void)[]() consteval { for (auto e : fn()) {} }; } void caller() { fn2(); } ``` The stated diagnostic is: ```cpp <source>:8:21: error: call to consteval function 'fn' is not a constant expression 8 | for (auto e : fn()) {} ``` The body of the lambda should be evaluated as within an immediate function context when the lambda is marked as `consteval`. Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
0 files changed, 0 insertions, 0 deletions