[Bug c++/105752] Template function can access private member

2022-06-02 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 Patrick Palka changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/105752] Template function can access private member

2022-06-02 Thread csaba_22 at yahoo dot co.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 --- Comment #5 from Csaba Ráduly --- The fact that GCC 11 shows an error for the code in comment #4 suggests that this was a bug which was fixed. Does it ring a bell to anyone? This bug should probably marked as a duplicate, but of which other b

[Bug c++/105752] Template function can access private member

2022-05-30 Thread csaba_22 at yahoo dot co.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 --- Comment #4 from Csaba Ráduly --- Looks like there *was* a bug, I just wasn't able to properly reproduce it initially: #include #include class CB { struct DCB {}; }; struct NMC1 : public CB { int meow() const { return __LINE__

[Bug c++/105752] Template function can access private member

2022-05-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 --- Comment #3 from Jonathan Wakely --- And if you never instantiate the function, who cares? It doesn't actually access the private member, because you never call it. And if you try to, it doesn't compile.

[Bug c++/105752] Template function can access private member

2022-05-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 --- Comment #2 from Jonathan Wakely --- Which is permitted by the standard.

[Bug c++/105752] Template function can access private member

2022-05-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 --- Comment #1 from Andrew Pinski --- There might already been a dup of this. Gcc does not do access checking until instantiation time (as you saw) even for non dependent things.