Issue 64777
Summary [C++20] [constexpr] virtual member function template specialisation compilation error
Labels new issue
Assignees
Reporter pkeir
    The C++20 code below fails to compile with Clang trunk (GCC and MSVC compile fine). Removing either both `constexpr` qualifiers; or the `virtual` specifier will remove the error.

```cpp
template <typename T> 
struct Foo 
{ 
  constexpr 
  virtual 
  void m() { } 
}; 
 
template<> 
constexpr 
void Foo<int*>::m() { }
```

The invocation and error message are below:

```
$ clang++ -std=c++20 -c test.cpp 
test.cpp:15:17: error: explicit specialization of 'm' after instantiation
void Foo<int*>::m() { }
 ^
test.cpp:15:6: note: implicit instantiation first required here
void Foo<int*>::m() { }
     ^
1 error generated.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to