Skip to content

[BUG] Multi-token type of prvalue not accounted for #525

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

Closed
JohelEGP opened this issue Jun 23, 2023 · 1 comment
Closed

[BUG] Multi-token type of prvalue not accounted for #525

JohelEGP opened this issue Jun 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@JohelEGP
Copy link
Contributor

Title: Multi-token type of prvalue not accounted for.

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

main: (args) = { _ = :* int = args.argc&; }
Commands:
cppfront main.cpp2
clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp

Expected result:

(void) std::type_identity_t<int*>{&args.argc}; }

Actual result and error:

(void) int*{&args.argc}; }
Cpp2 lowered to Cpp1:
//=== Cpp2 type declarations ====================================================


#include "cpp2util.h"



//=== Cpp2 type definitions and function declarations ===========================

auto main(int const argc_, char const* const* const argv_) -> int;


//=== Cpp2 function definitions =================================================

auto main(int const argc_, char const* const* const argv_) -> int{
                 auto args = cpp2::make_args(argc_, argv_); 
(void) int*{&args.argc}; }
Output:
main.cpp2:1:11: error: expected '(' for function-style cast or type construction
    1 | (void) int*{&args.argc}; }
      |        ~~~^
main.cpp2:1:11: error: initializer list cannot be used on the right hand side of operator '*'
    1 | (void) int*{&args.argc}; }
      |           ^~~~~~~~~~~~~
2 errors generated.
@hsutter
Copy link
Owner

hsutter commented Jul 24, 2024

Thanks! This has been resolved with subsequent commits, the example now works.

@hsutter hsutter closed this as completed Jul 24, 2024
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
Development

Successfully merging a pull request may close this issue.

2 participants