Issue 152750
Summary Variable template partial specializations are failing
Labels new issue
Assignees
Reporter Warpten
    ## Current behavior

Consider the following sample:

```cpp
    template<auto Us>
    static constexpr FlagsPredicate* predicate =
        [](const config::Configuration& config) {
            // Makes it dependant, always evaluates to false
 static_assert(sizeof...(Us) < 0, "Missing implementation of a flag predicate.");
            return false;
        };

    template<bool config::FeatureFlags::* flag>
    static constexpr FlagsPredicate* predicate<flag> =
        [](const config::Configuration& config) {
 return config.featureFlags.*flag;
        };

    template<bool config::DebugFlags::* flag>
    static constexpr FlagsPredicate* predicate<flag> =
        [](const config::Configuration& config) {
 return config.debugFlags.*flag;
        };
```

Clang fails the snippet above with the following error:
```
<source>:35:38: error: variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list
   35 | static constexpr FlagsPredicate* predicate<flag> =
      | ^        ~~~~~~
<source>:39:38: error: variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list
   39 |     static constexpr FlagsPredicate* predicate<flag> =
      | ^        ~~~~~~
2 errors generated.
Compiler returned: 1
```

Link to compiler explorer with minimal repro case: https://godbolt.org/z/4bn6Tv3Kr

GCC 15 accepts both variations.

## Expected behavior

A parameter pack workaround should not be needed.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to