-
Notifications
You must be signed in to change notification settings - Fork 260
[BUG] UFCS with variable template in scope fails #807
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
Comments
I noticed the same failure if you attempt to call This issue came up while implementing |
I think this one really is IFNDR. |
IIRC from my analysis at #307, it's that this can't be solved without Cpp1 reflection. |
The same seems to happen for |
The one case we can handle is when source local name lookup results in a variable.
auto main() -> int{
CPP2_UFCS_TEMPLATE(f<int>)(t());// OK.
auto g {0};
CPP2_UFCS_TEMPLATE(g<int>)(t());// S
static_cast<void>(std::move(g));
}
|
Title: UFCS with variable template in scope fails.
Description:
std::vector<int>().empty()
will fail givenusing std::views::empty;
.That should end up calling the member
empty
ofstd::vector
.But the UFCS macro fails on the free function branch.
All compilers fail: https://compiler-explorer.com/z/bWejqfodq.
With #506, MSVC starts accepting: https://compiler-explorer.com/z/TYaMW7av6.
Minimal reproducer (https://cpp2.godbolt.org/z/7nfzr7zYx):
Commands:
cppfront main.cpp2 clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -I . main.cpp
Expected result: A well-formed program that calls the member
empty
ofstd::vector
.Actual result and error:
Cpp2 lowered to Cpp1:
Output:
The text was updated successfully, but these errors were encountered: