Skip to content

[BUG] Parameter named after contextual keyword is lost #397

Closed
@JohelEGP

Description

@JohelEGP

Title: Parameter named after contextual keyword is lost.

Such a Cpp2 parameter is lowered to Cpp1 as no parameter at all.

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

t: type = {
  f: (in) = { }
}
g: (final) = { }
// h: (out, x) = { } // Error!
main: () = { }

Commands:

cppfront -clean-cpp1 main.cpp2
clang++17 -std=c++2b -stdlib=libc++ -lc++abi -I . main.cpp

Expected result:
A diagnostic,
or the equivalent using y as an identifier.

Actual result and error:

#include "cpp2util.h"

class t;
  
class t {
  public: static auto f() -> void;

  public: t() = default;
  public: t(t const&) = delete;
  public: auto operator=(t const&) -> void = delete;
};
auto g() -> void;
// h: (out, x) = { } // Error!
auto main() -> int;

  auto t::f() -> void{}

auto g() -> 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