https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100231

            Bug ID: 100231
           Summary: [C++17] Variable template specialization inside a
                    class gives compilation error
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krzyk240 at gmail dot com
  Target Milestone: ---

On the following code:
```
template<class T>
struct X {};

class Foo {
    template<class...>
    static constexpr inline bool bar = false;
    template<class T>
    static constexpr inline bool bar<X<T>> = true;
};
```
GCC gives error:
<source>:8:34: error: explicit template argument list not allowed
    8 |     static constexpr inline bool bar<X<T>> = true;
      |                                  ^~~~~~~~~

But Clang, ICC and MSVC compile it correctly.

Defining variable template bar outside of Foo class produces no compile errors.

Compilation command: g++ example.cpp -std=c++17

Live example: https://godbolt.org/z/54hqYxe4P

Reply via email to