This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Implement P2738R1 - constexpr cast from void*
ClosedPublic

Authored by cor3ntin on Jun 24 2023, 7:48 AM.

Details

Reviewers
erichkeane
Group Reviewers
Restricted Project
Commits
rGf27afedc6c86: [Clang] Implement P2738R1 - constexpr cast from void*

Diff Detail

Event Timeline

cor3ntin created this revision.Jun 24 2023, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2023, 7:48 AM
cor3ntin requested review of this revision.Jun 24 2023, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2023, 7:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cor3ntin added a reviewer: Restricted Project.Jun 24 2023, 7:49 AM
cor3ntin updated this revision to Diff 534328.Jun 25 2023, 4:16 AM

Rebase and update feature macro tests.

erichkeane added inline comments.
clang/lib/AST/ExprConstant.cpp
8921

Does this diagnostic work? In the case of the !C++26, the arity of the message is different, right? Do you have a test for this in not c++26 mode that you can post? I Am not sure we do 'fill ins' for discarded 'select' branches.

cor3ntin updated this revision to Diff 534524.Jun 26 2023, 6:39 AM

Add tests for C++23

clang/lib/AST/ExprConstant.cpp
8921

Yes, we do that in a few places. I added tests.

erichkeane accepted this revision.Jun 26 2023, 6:40 AM
This revision is now accepted and ready to land.Jun 26 2023, 6:40 AM
This revision was landed with ongoing or failed builds.Jun 26 2023, 7:45 AM
This revision was automatically updated to reflect the committed changes.
shafik added a subscriber: shafik.Jun 26 2023, 3:13 PM
shafik added inline comments.
clang/test/CXX/expr/expr.const/p5-26.cpp
13

Why no diagnostic on this line and the next?

cor3ntin added inline comments.Jun 29 2023, 1:49 AM
clang/test/CXX/expr/expr.const/p5-26.cpp
13

Why do you expect one?
you can add const/volatile (but not remove const) in a static_cast https://godbolt.org/z/qEqoEWohc
In c++23, no diag because we stop evaluating the function at that point.