hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.39k stars 232 forks source link

[BUG] Missing ellipsis of pack in _qualified-id_ of definition #875

Closed JohelEGP closed 7 months ago

JohelEGP commented 8 months ago

Title: Missing ellipsis of pack in qualified-id of definition.

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

t: @struct <Args...> type = {
  f: <T> () = { }
}
main: () = { }

Commands: ```bash cppfront main.cpp2 clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -Werror=unused-value -Werror=unused-parameter -I . main.cpp ```

Expected result:

  template <typename ...Args> template<typename T> auto t<Args...>::f() -> void{}

Actual result and error:

  template <typename ...Args> template<typename T> auto t<Args>::f() -> void{}

Cpp2 lowered to Cpp1: ```C++ //=== Cpp2 type declarations ==================================================== #include "cpp2util.h" #line 1 "/app/example.cpp2" template class t; #line 2 "/app/example.cpp2" //=== Cpp2 type definitions and function declarations =========================== #line 1 "/app/example.cpp2" template class t { #line 2 "/app/example.cpp2" public: template static auto f() -> void; }; auto main() -> int; //=== Cpp2 function definitions ================================================= #line 1 "/app/example.cpp2" #line 2 "/app/example.cpp2" template template auto t::f() -> void{} auto main() -> int{} ```

Output:

main.cpp2:2:57: error: qualifier contains unexpanded parameter pack 'Args'
    2 |   template <typename ...Args> template<typename T> auto t<Args>::f() -> void{}
      |                                                         ^
1 error generated.