[Bug c++/85943] New: Template function permits outside access to private variable
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85943 Bug ID: 85943 Summary: Template function permits outside access to private variable Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: achuah at drwsg dot com Target Milestone: --- This probably should be classified under meta-bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59002 See this example on Godbolt's compiler explorer: https://godbolt.org/g/skvWAt If the accessing function were not a template function, then GCC correctly prevents the private access. If the private member was a function instead of a variable, then GCC correctly prevents the private access, but only upon instantiation. Note: in all of these cases, clang will not compile, regardless of whether there's been an instantiation of the template.
[Bug c++/85943] Template function permits outside access to private variable
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85943 --- Comment #1 from Anthony Chuah --- Clarifications: This bug applies to static variables, not non-static ones. Please use this example instead: https://godbolt.org/g/LzrzDj
[Bug c++/85943] Template function permits derived class access to private base class static variable
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85943 Anthony Chuah changed: What|Removed |Added Summary|Template function permits |Template function permits |outside access to private |derived class access to |variable|private base class static ||variable --- Comment #2 from Anthony Chuah --- Apologies for yet another edit: next time I'll make sure to have the fully-written report before submitting. The issue appears to be that GCC will permit a derived class access to a private static variable of its base class. Please use this repro example instead https://godbolt.org/g/A3zCLk, because it has a listing of different test cases.
[Bug c++/83766] New: Bug 67632 not fixed yet
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83766 Bug ID: 83766 Summary: Bug 67632 not fixed yet Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: achuah at drwsg dot com Target Milestone: --- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67632 I've tested it on gcc 6.1.0, and the same problem is still there. From the bug tracker it looks like the bug was acknowledged to be an issue, but never eventually followed up on. Target: x86_64-linux-gnu gcc version 6.1.0
[Bug libstdc++/67632] explicit instantiation omits copy constructor and others
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67632 Anthony Chuah changed: What|Removed |Added CC||achuah at drwsg dot com --- Comment #8 from Anthony Chuah --- This bug still isn't fixed as of gcc 6.1.0.
[Bug libstdc++/67632] explicit instantiation omits copy constructor and others
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67632 --- Comment #9 from Anthony Chuah --- Forgot to add: this bug exists also for clang 5.0.0. % clang++ -std=c++11 --gcc-toolchain=/path/to/gcc t.o x.cc /tmp/x-063634.o: In function `copy(std::unordered_map, std::equal_to, std::allocator > > const&)': x.cc:(.text+0x18): undefined reference to `std::unordered_map, std::equal_to, std::allocator > >::unordered_map(std::unordered_map, std::equal_to, std::allocator > > const&)' clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)