[Bug c++/96884] Missing diagnostics when applying the member operator on this in class template

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 1 16:37:45 GMT 2020


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We give an error when you actually call f in an instance of V:

96884.C: In instantiation of ‘void V<T>::f() [with T = int]’:
96884.C:14:9:   required from here
96884.C:7:16: error: request for member ‘a’ in ‘(V<int>*)this’, which is of
pointer type ‘V<int>*’ (maybe you meant to use ‘->’ ?)
    7 |           this.a = 0;
      |           ~~~~~^

which is OK.


More information about the Gcc-bugs mailing list