http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59191
Bug ID: 59191 Summary: Accessibility of types not checked in template functions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: akim.demaille at gmail dot com Hi all, Below, GCC forgets to check the accessibility of "type", which turns out to be private: $ cat foo.cc class foo { typedef int type; }; template <typename T> foo::type bar() { return 1; } int main() { return bar<char>(); } $ g++-mp-4.9 -Wall foo.cc $ clang++-mp-3.1 -Wall foo.cc foo.cc:7:6: error: 'type' is a private member of 'foo' foo::type bar() ^ foo.cc:3:15: note: implicitly declared private here typedef int type; ^ 1 error generated. All the GCCs I have access to (4.4 .. 4.9) exhibit the same behavior. Cheers!