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

--- Comment #15 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Nathaniel Shead from comment #14)
> Created attachment 61550 [details]
> pr113563 testcase
> 
> I'd briefly started looking at this a while back and had written some tests,
> but I'd gotten stuck and never progressed.  In case it's helpful attached is
> the testcase I'd written; it looks like some of these tests pass now but we
> still get some errors and an ICE, not sure if that should be a separate PR
> now though.

This is very helpful, thanks.  But I disagree with one of the tests:

    return [*this](this auto&& self) {
      static_assert(is_const_ref<decltype((x))> ==
is_const_ref<decltype(self)>);
      static_assert(refqual<decltype((x))> == refqual<decltype(self)>);
    };

this seems equivalent to

struct A { int x; };
template <class T> void f(T&& t)
{
  static_assert (refqual<decltype((t.x))> == refqual<decltype(t)>);
};
int main() { f(A()); }

which does not hold; t.x is an lvalue.  The test should check decltype((self))
instead.  I'll make that adjustment when adding it.

Reply via email to