Skip to content

[Clang] Variadic template template parameter of another template template parameter causes spurious error upon instantiation #130362

Closed
@ednolan

Description

@ednolan

Given the following code:

template <template <template <typename...> typename> typename>
struct foo {};

template <template <typename> typename>
struct bar {};

using baz = foo<bar>;

Clang 20 produces the following error:

<source>:1:52: error: too few template parameters in template template parameter redeclaration
    1 | template <template <template <typename...> typename> typename>
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
    2 | struct foo {};
      | ~~~~~~~~~~~~~~
    3 | 
    4 | template <template <typename> typename>
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:7:17: note: template template argument is incompatible with its corresponding template template parameter
    7 | using baz = foo<bar>;
      |                 ^
<source>:4:39: note: template parameter is declared here
    4 | template <template <typename> typename>
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
<source>:7:17: note: template template argument is incompatible with its corresponding template template parameter
    7 | using baz = foo<bar>;
      |                 ^
<source>:1:62: note: template parameter is declared here
    1 | template <template <template <typename...> typename> typename>
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Compiler explorer link: https://godbolt.org/z/7q7n459E1

This code was accepted by Clang 19, and is accepted by GCC, MSVC, and EDG.

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions