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

            Bug ID: 119452
           Summary: Should copy ctor of template class be allowed to have
                    specified template argument?
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

Consider the following code:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

template<typename T>
class Box
{
public:
  Box(const Box<int>&)=default;
  //Box(const Box<T>&)=default;
};

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is rejected by gcc and MSVC, but accepted by clang:
https://godbolt.org/z/j641vq7W8

I thought it was clang's bug but the developer indicated that this should be
well-formed as sema analysis should be delayed until template instantiation.
I'm quite puzzled about that.

Please see the discussion on llvm's bug tracker:
https://github.com/llvm/llvm-project/issues/99749

Reply via email to