https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- There might already been a dup of this. Gcc does not do access checking until instantiation time (as you saw) even for non dependent things.