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

            Bug ID: 99686
           Summary: ICE when concepts on C++17 when providing both T&& and
                    const T& specialization
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: StevenSun2021 at hotmail dot com
  Target Milestone: ---

This problem occurs only when using std=c++17 and -fconcepts. It compiles when
using std=c++20.


I also have an online compiler link for this. https://godbolt.org/z/W9r6Wx

-------------------------------------------------------------------------
template <typename T>
void func(T &&arg)
{
}

template <typename T>
requires requires(T t) { ++t; }
void func(T &&arg)
{
}

template <>
void func(int &&arg)
{
}

template <>
void func(const int &arg)
{
}

int main()
{
    func(1); // I am expecting func(int&&)
}

Reply via email to