https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64335
--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> --- Pardon that, the latter example contains remnants of other experiments. Here's a simplified version, (not that it really should matter :) ) class foo { class bar {}; }; int main() { decltype (foo::bar) y; } This is rejected properly.