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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-07-20
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hubert Tong from comment #8)
> (In reply to Andrew Pinski from comment #7)
> > Those are all unevulated context.that is sizeof and decltype are both
> > considered unevulated context. In them, gcc does not think &(T::x) and &T::x
> > act differently.
> 
> I am not seeing how you reached the conclusion that GCC does not think
> &(T::x) and &T::x act differently.

I said outside of an unevaluated context. the uses you have are inside an
unevaluated context still.

Try this:
```

struct A { int x; };

template <typename T>
constexpr auto f() {
  return &T::x;
}

template <typename T>
constexpr auto f1() {
  return &(T::x);
}

auto g = f<A>();
auto g1 = f1<A>();
```

You will see GCC rejects the definition of f1<A> correctly.

Reply via email to