Skip to content

[BUG] Parameter direction for template parameter is ignored #425

Closed
@JohelEGP

Description

@JohelEGP

Title: Parameter direction for template parameter is ignored.

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

a: <in T> type = { }
b: <in V: _> type = { }
main: () = { }

Commands:

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

Expected result:

For the : type case, a diagnostic.
For the : _ case, adherence to the specified parameter direction.

template<typename T> class a; // A Cpp2 diagnostic here.
template<const auto& V> class b;

Actual result and error:

template<typename T> class a;
template<auto V> class b;
Program returned: 0
Cpp2 lowered to Cpp1.
#include "cpp2util.h"

template<typename T> class a;
template<auto V> class b;

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

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

};
auto main() -> int;

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