-
Notifications
You must be signed in to change notification settings - Fork 264
Description
Title: <...> lowers to unnamed pack.
Description:
Since commit 025d7af, ... is an identifier.
So ... in a template-parameter-declaration-list lowers to typename ...,
just like T would lower to typename T.
Feature or bug?
I call bug.
#603 makes it so that template template parameters are emitted.
Because it chooses to lower them unnamed, it lowers T: <...> to template<typename> class T.
The existing branch in main to print a pack's ellipsis,
if (n.declaration->is_variadic) { (https://github.com/hsutter/cppfront/pull/603/files#diff-e683e1259bbc0d6de7f1fbf797fb772f31a0a1ef2254ec317d15c298102fa3f3R3931)
isn't exercised because it the declaration isn't variadic (it's name just happens to be ...).
Minimal reproducer (https://cpp2.godbolt.org/z/YbzMc3dh3):
f: <...> () = { }
main: () = { }
Commands:
cppfront main.cpp2
clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -I . main.cppExpected result: A diagnostic due to naming a declaration ....
Actual result and error:
Program returned: 0
template<typename ...> auto f() -> void{}Cpp2 lowered to Cpp1:
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
//=== Cpp2 type definitions and function declarations ===========================
template<typename ...> auto f() -> void;
auto main() -> int;
//=== Cpp2 function definitions =================================================
template<typename ...> auto f() -> void{}
auto main() -> int{}