Skip to content

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

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 9, 2023 · 0 comments · Fixed by #599
Closed

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

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

Comments

@JohelEGP
Copy link
Contributor

JohelEGP commented Jun 9, 2023

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{}
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.

1 participant