https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58993
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2013-11-05 00:00:00 |2018-2-27 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Warning-free testcase: class base { private: void foo() { } }; template <typename T> struct bar : public base { void test() { (void) &base::foo; // should be rejected } }; template <> struct bar<void> : public base { void test() { // &base::foo; // correctly rejected } }; int main() { bar<int>().test(); bar<void>().test(); } Still accepted by trunk. Clang says: 58993.cc:9:23: error: 'foo' is a private member of 'base' (void) &base::foo; // should be rejected ^ 58993.cc:3:10: note: declared private here void foo() { } ^ 1 error generated. and EDG says: "58993.cc", line 9: error: function "base::foo" (declared at line 3) is inaccessible (void) &base::foo; // should be rejected ^ detected during instantiation of "void bar<T>::test() [with T=int]" at line 21 1 error detected in the compilation of "58993.cc".