<a id="title"/> **[T](#title)itle**: [NTTP][] can't be variadic or unnamed. <a id="desc"/> <!-- **[D](#desc)escription**: --> <a id="rep"/> <a id="cpp2"/> **[M](#rep)inimal reproducer** (<https://cpp2.godbolt.org/z/rdb6dbvv1>): ```Cpp2 t: @struct <_...: _> type = { f: <_: int> () -> i32 = 0; } main: () = { } ``` <a id="cmd"/> <details><summary> <b><a href="#cmd">C</a>ommands</b>: </summary> ```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 ``` </details> <a id="expected"/> **[E](#expected)xpected result**: 1. #812 for [NTTP][]s. 2. f6ecbb4349e3f477205c68c87c3a17a52688ff9c for NTTPs. <a id="actual"/> **[A](#actual)ctual result and error**: ```C++ template<auto _> class t { public: template<int _> [[nodiscard]] static auto f() -> cpp2::i32; }; ``` <a id="cpp1"/> <details><summary> <a href="#cpp1">C</a>pp2 lowered to Cpp1: </summary> ```C++ //=== Cpp2 type declarations ==================================================== #include "cpp2util.h" #line 1 "/app/example.cpp2" template<auto _> class t; #line 2 "/app/example.cpp2" //=== Cpp2 type definitions and function declarations =========================== #line 1 "/app/example.cpp2" template<auto _> class t { #line 2 "/app/example.cpp2" public: template<int _> [[nodiscard]] static auto f() -> cpp2::i32; }; auto main() -> int; //=== Cpp2 function definitions ================================================= #line 1 "/app/example.cpp2" #line 2 "/app/example.cpp2" template <auto _> template<int _> [[nodiscard]] auto t<_>::f() -> cpp2::i32 { return 0; } auto main() -> int{} ``` </details> <a id="out"/> <!-- <details><summary> --> <a href="#out">O</a>utput: <!-- </summary> --> ```output main.cpp2:2:24: error: declaration of '_' shadows template parameter 2 | public: template<int _> [[nodiscard]] static auto f() -> cpp2::i32; | ^ main.cpp2:1:15: note: template parameter is declared here 1 | template<auto _> class t { | ^ ``` <!-- </details> --> <a id="see"/> **[S](#see)ee also**: - <https://github.com/hsutter/cppfront/issues/812#issuecomment-1826097667>. <a id="ack"/> <!-- <details><summary> <b><a href="#ack">A</a>cknowledgements</b>: </summary> - </details> --> [ABI]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#abi-api [ADL]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#adl [CNTTP]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#cnttp [CPO]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#cpo [CRTP]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#crtp [CTAD]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#ctad [WG]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#cwg-ewg-ewgi-lewg-lewgi-lwg [SG]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#cwg-ewg-ewgi-lewg-lewgi-lwg [EH]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#eh-tdeh [HALO]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#halo [ICE]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#ice [IFNDR]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#ifndr [II]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#iile [NSDMI]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#nsdmi [NTTP]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#nttp [ODR]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#odr [PIMPL]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#pimpl [QoI]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#qoi [RVO]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#rvo-nrvo-urvo [SBO]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#sbo-soo-sso [SCARY]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#scary-iterators [SFINAE]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#sfinae [SMF]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#smf [STL]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#stl [TMP]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#tmp [TU]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#tu [UB]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#ub [UDL]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#udl [UFCS]: https://quuxplusone.github.io/blog/2019/08/02/the-tough-guide-to-cpp-acronyms/#ufcs
Activity