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

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #3 from Harald van Dijk <harald at gigawatt dot nl> ---
Somewhat reduced:

template <typename T>
struct A
{
  template <typename T2>
  void f();
};

template <typename T>
struct B
{
  int &f() const;

  template <typename T2 = T, typename = decltype(A<T2>().template f<T2>(T2()))>
  void f();

  void g() {
    int *i = &B<int>().f();
  }
};

Accepted by clang 3.4.2, rejected by gcc 4.8.3 and 4.9.0 with:

test.cc: In member function ‘void B<T>::g()’:
test.cc:17:26: error: lvalue required as unary ‘&’ operand

It seems to only happen when certain operators are used: there is no error when
doing e.g.

  int &i = B<int>().f();

Reply via email to