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

--- Comment #10 from Hubert Tong <hstong at ca dot ibm.com> ---
(In reply to Andrew Pinski from comment #9)
> (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.

The standard explicitly makes an exception for the use in an unevaluated
context: https://wg21.link/expr.prim.id.general#4.3

When GCC accepts the use in an unevaluated context, it is right (and it is
getting the correct type) afaict.

The only proximate issue with GCC that I have found is the template declaration
matching issue.

Reply via email to