Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang] call HandleImmediateInvocation before checking for immediate escacalating expressions #124414

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add additional test
cor3ntin committed Jan 26, 2025
commit 92bd92a10cd75a6c9feff803d837cffdb7b220b5
17 changes: 17 additions & 0 deletions clang/test/SemaCXX/cxx2b-consteval-propagate.cpp
Original file line number Diff line number Diff line change
@@ -528,3 +528,20 @@ D d(0); // expected-note {{in implicit initialization for inherited constructor
// expected-error@-1 {{call to immediate function 'GH112677::D::SimpleCtor' is not a constant expression}}

}


namespace GH119046 {

template <typename Cls> constexpr auto tfn(int) {
return (unsigned long long)(&Cls::sfn);
//expected-note@-1 {{'tfn<GH119046::S>' is an immediate function because its body evaluates the address of a consteval function 'sfn'}}
};
struct S { static consteval void sfn() {} };

int f() {
int a = 0; // expected-note{{declared here}}
return tfn<S>(a);
//expected-error@-1 {{call to immediate function 'GH119046::tfn<GH119046::S>' is not a constant expression}}
//expected-note@-2 {{read of non-const variable 'a' is not allowed in a constant expression}}
}
}