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

            Bug ID: 98614
           Summary: Copy ctor/assign cannot be defaulted in specialization
                    by concept
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iDingDong at outlook dot com
  Target Milestone: ---

GCC 10.2 rejects the following piece of code:

//---
#include <concepts>

template <typename T> struct A {
        A(A<T> const&) = default;
};

template <std::same_as<int> T> struct A<T> {
        A(A<T> const&) = default;
};
//---

The error message:

> <source>:8:19: error: 'A<T>::A(const A<T>&)' cannot be defaulted

This can be reproduced by the compiler explorer: https://godbolt.org/z/1v6nPv

I can locally reproduce this with:

> g++ -std=c++20 test.cpp

This error only occurs when trying to default a copy constructor in a partial
specialization involving concept. The workaround is to omit the `<T>` in the
constructor/assignment's argument declarator.

PS: move constructor/assignment seems unaffected.

Reply via email to