public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/96884] New: Missing diagnostics when applying the member operator on this in class template @ 2020-09-01 16:20 anders.granlund.0 at gmail dot com 2020-09-01 16:37 ` [Bug c++/96884] " mpolacek at gcc dot gnu.org 2020-09-08 6:55 ` anders.granlund.0 at gmail dot com 0 siblings, 2 replies; 3+ messages in thread From: anders.granlund.0 at gmail dot com @ 2020-09-01 16:20 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96884 Bug ID: 96884 Summary: Missing diagnostics when applying the member operator on this in class template Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: anders.granlund.0 at gmail dot com Target Milestone: --- Program (main.cpp): template<typename T> class V { int *a; void f() { this.a = 0; } }; int main() { } Compilation command line: g++ -std=c++17 -pedantic-errors main.cpp Observed behaviour: No compilation errors. Expected behaviour: Compilation error about incorrectly trying to use the member operator (.) instead of (->) on the this keyword. Note: clang++ gives the expected error message. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/96884] Missing diagnostics when applying the member operator on this in class template 2020-09-01 16:20 [Bug c++/96884] New: Missing diagnostics when applying the member operator on this in class template anders.granlund.0 at gmail dot com @ 2020-09-01 16:37 ` mpolacek at gcc dot gnu.org 2020-09-08 6:55 ` anders.granlund.0 at gmail dot com 1 sibling, 0 replies; 3+ messages in thread From: mpolacek at gcc dot gnu.org @ 2020-09-01 16:37 UTC (permalink / raw) To: gcc-bugs 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. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/96884] Missing diagnostics when applying the member operator on this in class template 2020-09-01 16:20 [Bug c++/96884] New: Missing diagnostics when applying the member operator on this in class template anders.granlund.0 at gmail dot com 2020-09-01 16:37 ` [Bug c++/96884] " mpolacek at gcc dot gnu.org @ 2020-09-08 6:55 ` anders.granlund.0 at gmail dot com 1 sibling, 0 replies; 3+ messages in thread From: anders.granlund.0 at gmail dot com @ 2020-09-08 6:55 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96884 Anders Granlund <anders.granlund.0 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #2 from Anders Granlund <anders.granlund.0 at gmail dot com> --- Yes. You are correct this is not a bug. The standard allows both possibilities in this case. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-08 6:55 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-09-01 16:20 [Bug c++/96884] New: Missing diagnostics when applying the member operator on this in class template anders.granlund.0 at gmail dot com 2020-09-01 16:37 ` [Bug c++/96884] " mpolacek at gcc dot gnu.org 2020-09-08 6:55 ` anders.granlund.0 at gmail dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).