-
Notifications
You must be signed in to change notification settings - Fork 260
[BUG] Lookup of emitted definition differs from what's apparent in source code #704
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
This is the same issue (or sufficiently similar) as pointed out by commit ca42e2c.
Well, that wasn't it.I don't know the "dance". Previously.IIUC, it's so that both of these parameters are emitted equally (https://cpp2.godbolt.org/z/enPGfjx7a):
It currently emits: template <typename T> auto operator+([[maybe_unused]] cpp2::in<t> param1, [[maybe_unused]] cpp2::in<t<T>> param2) -> void{} But should be template <typename T> auto operator+([[maybe_unused]] cpp2::in<t<T>> param1, [[maybe_unused]] cpp2::in<t<T>> param2) -> void{} Because |
It's like templated
|
There seems to be a simpler solution accepted by the supported compilers. |
Anyways, the same issue pops up again when you use a name in
//=== Cpp2 type definitions and function declarations ===========================
public: template<v<u> _> static const int a;
//=== Cpp2 function definitions =================================================
template<v<u> _> inline CPP2_CONSTEXPR int t::a = 0;
|
Using a function (https://cpp2.godbolt.org/z/3hbPMT5ar):
|
Now we have a local name lookup algorithm. Taking the example above, |
Title: Type-scope object alias of nested type needs explicit qualification.
Description:
This is relevant to type-scope object alias
emitted during Phase 2 "Cpp2 type definitions and function declarations"
(all of them if #700 isn't fixed).
Lookup for the variable's type doesn't include the declaring class
because
t::
hasn't been parsed.Worse, there is a mismatch if lookup finds something else.
Of course,
a: t::u == u();
would work,but you wouldn't guess it just looking at Cpp2.
Minimal reproducer (https://cpp2.godbolt.org/z/oKP3Yev44):
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.
Actual result and error:
Cpp2 lowered to Cpp1:
When lookup doesn't find
u
:When lookup finds another
u
:The text was updated successfully, but these errors were encountered: