https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106287
Bug ID: 106287
Summary: Implicit virtual destructor needs to be explicitly
defaulted for constant evaluation
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: johelegp at gmail dot com
CC: johelegp at gmail dot com
Target Milestone: ---
See https://godbolt.org/z/4WaevWoEs.
```C++
template<class T> struct A : T {
constexpr A(T v) : T{v} { }
// ~A() = default; // Fixes GCC.
};
struct B {
virtual ~B() = default;
};
inline constexpr auto x = A{B{}};
```
```
<source>:10:32: error: 'virtual constexpr A<B>::~A()' used before its
definition
10 | inline constexpr auto x = A{B{}};
| ^
Compiler returned: 1
```