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

            Bug ID: 104577
           Summary: needs copy constructor to call method of class
                    non-type template parameter
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenb...@fh-soft.de
  Target Milestone: ---

% cat test.cpp
struct S
{
  constexpr S () = default;
  S (S &&) = delete;
  operator int () const { return 0; }
};

template <S s> int i = s;

int main ()
{
  return i <S { }>;
}
% g++ -std=c++20 test.cpp
test.cpp:8:20: error: use of deleted function 'constexpr S::S(const S&)'
test.cpp:1:8: note: 'constexpr S::S(const S&)' is implicitly declared as
deleted because 'S' declares a move constructor or move assignment operator

I don't see why a copy constructor should be needed here. (clang accepts it.)

Reply via email to