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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |redi at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-07-05

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
>From PR libstdc++/106201:

struct foo
{
  template<typename T, typename = decltype(f(*(T*)nullptr))>
    foo(const T&) { }
};

struct bar { };

struct baz
{
  template<typename T> baz(const T&) { }
};

void f(foo&);
void f(baz);

int main()
{
  bar b;
  f(b);
}

G++ goes into infinite recursion, Clang, EDG and MSVC accept it.

That was reduced from one using concepts:

namespace effing
{
  template<typename T>
    concept effable = requires (T& t) { f(t); };

  template <class T>
    requires effable<T> || true
  void eff(T&&) { }
}

struct path {
  template<effing::effable T> path(const T&) { }
};

void f(path&);

struct iterator { };

int main()
{
  iterator i;
  effing::eff(i);
}

Reply via email to