https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65636
--- Comment #2 from Andrew Sutton <andrew.n.sutton at gmail dot com> --- Confirmed and with a tentative fix in r221856. Certain type declarations occurring at namespace scope are not given C++ language extensions, so when we try to pass those through tsubst_decl, the specialization handling bits fail. This prevents those from being used, but still performs the substitution, performing access checks, copying attributes, etc. I'd like a maintainer to look at the solution. There's probably a better way to address the problem.