http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52965
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-12 22:56:05 UTC --- I don't think it's a bug. G++ doesn't ignore access checking, you never use the name PVT so there's no violation. The type exists, you just can't access the name PVT. But you can give it a new name e.g. template<typename T> void f(T t) { typedef T type; } f(c.p()); Or, closer to the auto case: decltype(c.p()) p = c.p();