https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119056
Bug ID: 119056 Summary: class template with non-type argument does not recognize copy/move constructor prototype when parameter is not using the template argument Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sandberg.sven at gmail dot com Target Milestone: --- This does not compile with any gcc version up to 14.2.0 or trunk (https://godbolt.org/z/61av75zzx): ``` #include <concepts> // same_as template <bool x> class C { static constexpr bool m_x = x; public: static_assert(std::same_as<C<x>, C<m_x>>); // ok C(const C<x> &) = default; // ok C(C<m_x> &&) = default; // error: 'C<x>::C(C<m_x>&&)' cannot be defaulted }; ``` It does compile on clang. The same issue occurs for all copy/move constructors and copy/move assignment operators. Apparently, gcc does not recognize that the prototype is a copy constructor (copy/move constructor/operator) when the parameter type's template argument is specified using the static constexpr member variable `m_x` instead of the template argument `x`.