[PATCH] D111400: [Clang] Implement P2242R3
Hubert Tong via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 27 22:24:48 PDT 2021
hubert.reinterpretcast added a comment.
Lambda capture semantics mean that extensions or inconsistencies in constexpr evaluation result in binary-compatibility issues.
struct NonLit {
NonLit();
};
template <typename T>
constexpr int foo() {
return 42;
T t;
}
extern int g(void *);
inline int f(void *p) {
const int x = foo<NonLit>();
auto ff = [=] { return x; };
using ty = decltype(ff);
if (p) {
return (*(ty *)p)();
}
return g(&ff);
}
int g(void *p) { if (!p) return 0; return f(p); }
Notice that GCC reads from the closure object in C++20: https://godbolt.org/z/vYs63h8vb.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111400/new/
https://reviews.llvm.org/D111400
More information about the cfe-commits
mailing list