Skip to content

[BUG] Last temporary in signature emitted with parenthesis #503

Closed
@JohelEGP

Description

@JohelEGP

Title: Last temporary in signature emitted with parenthesis.

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

pair: <L: _, R: _> type = { }
g: (x: pair<:i32 = (0), :i32 = (0)>) = { }
main: () = { }
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:

auto g(cpp2::in<pair<cpp2::i32{0},cpp2::i32{0}>> x) -> void;

Actual result and error:

auto g(cpp2::in<pair<cpp2::i32{0},cpp2::i32{(0)}>> x) -> void;
//                                          ^ ~
Cpp2 lowered to Cpp1:
#include "cpp2util.h"

template<auto L, auto R> class pair;

template<auto L, auto R> class pair {
      public: pair() = default;
      public: pair(pair const&) = delete; /* No 'that' constructor, suppress copy */
      public: auto operator=(pair const&) -> void = delete;

};
auto g(cpp2::in<pair<cpp2::i32{0},cpp2::i32{(0)}>> x) -> void;
auto main() -> int;

auto g(cpp2::in<pair<cpp2::i32{0},cpp2::i32{(0)}>> x) -> void{}
auto main() -> int{}

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