Skip to content

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

Closed
@JohelEGP

Description

@JohelEGP

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions