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

[BUG] Pointer type not parsed as template argument #502

Closed
JohelEGP opened this issue Jun 9, 2023 · 3 comments · Fixed by #521
Closed

[BUG] Pointer type not parsed as template argument #502

JohelEGP opened this issue Jun 9, 2023 · 3 comments · Fixed by #521
Labels
bug Something isn't working

Comments

@JohelEGP
Copy link
Contributor

JohelEGP commented Jun 9, 2023

Title: Pointer type not parsed as template argument.

Description:

See #456 (comment).
It's valid grammar.
I guess the error is being emitted
while parsing the expression production
without regard for the context.

Minimal reproducer (https://cpp2.godbolt.org/z/rWYevT9h7):

main: () = std::is_void_v<* i32>;
Commands:
cppfront -clean-cpp1 main.cpp2
clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp

Expected result:

Program returned: 0

Actual result and error:

Output:
main.cpp2(1,27): error: prefix '*ptr' dereference is not valid Cpp2; use postfix 'ptr*' instead
@JohelEGP JohelEGP added the bug Something isn't working label Jun 9, 2023
@MaxSagebaum
Copy link
Contributor

This is also true for const modifier:

main: () = std::is_void_v< const i32>;

cppfront output is:

emp.cpp2...
temp.cpp2(1,34): error: ill-formed initializer (at 'i32')
temp.cpp2(1,1): error: unexpected text at end of Cpp2 code section (at 'main')
temp.cpp2(1,0): error: parse failed for section starting here

I tried to have a look at the parsing. Either the template parse needs to be elevated before the binary < operator or this error needs to be non fatal.

@JohelEGP
Copy link
Contributor Author

That's the point of the linked issue in the description.

@MaxSagebaum
Copy link
Contributor

Sorry missed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants