Skip to content

[clang][rejects-valid] unfound constrained partial specialization of class template with variadic NTTP of class type #132562

@ericniebler

Description

@ericniebler

The following valid C++20 code is rejected by clang trunk:

struct Integer
{
  int value{};
};

template <Integer... X>
struct Type;

template <Integer... X>
  requires ((X.value == 0) ||...)
struct Type<X...>
{
};

result:

<source>:11:8: error: class template partial specialization is not more specialized than the primary template [-Winvalid-partial-specialization]
   11 | struct Type<X...>
      |        ^
<source>:7:8: note: template is declared here
    7 | struct Type;
      |        ^
1 error generated.

This bug requires the class type to be parameterized on a variadic pack of non-type template parameters of class type.

repro:
https://godbolt.org/z/fYKe1MEeK

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"regression:20Regression in 20 releaserejects-valid

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions