[PATCH] D155175: [Clang] Fix consteval propagation for aggregates and defaulted constructors
Corentin Jabot via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 20 05:06:48 PDT 2023
cor3ntin updated this revision to Diff 542435.
cor3ntin added a comment.
Remove an assert (added in a previous iteration of this PR).
Unfortunately, we sometimes do emit the address of an immediate function,
after we establish the program is ill-formed - as we still proceed to code gen.
cpp
consteval int id(int i) { return i; }
constexpr int f(auto t) {
return t + id(t);
}
auto b = &f<int>;
We establish taking the address of &f<int> is not possible
when exiting the evaluation context.
At this point b has an init expression, which codegen will try to emit.
Ideally we should try to remove the init all together after the fact but so far
I have not been able to do so.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155175/new/
https://reviews.llvm.org/D155175
Files:
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGenCXX/cxx2c-consteval-propagate.cpp
clang/test/SemaCXX/cxx2a-consteval-default-params.cpp
clang/test/SemaCXX/cxx2b-consteval-propagate.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155175.542435.patch
Type: text/x-patch
Size: 22580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/817a0b5e/attachment.bin>
More information about the llvm-commits
mailing list