https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101213

--- Comment #2 from Jeremy R. <llvm at rifkin dot dev> ---
(In reply to Jonathan Wakely from comment #1)
> This is just how GCC recovers from a bad parse, so that it can attempt to
> continue and give diagnostics for the rest of the code. An invalid type in
> certain declaration contexts is replaced with 'int'. Often it does more harm
> than good, because you get errors about int::foo being invalid because it's
> not a class type (which is true, but then it wasn't int in the original
> code!)
> 
> I've sometimes wondered whether it would be better to use an invented,
> incomplete class type as the default instead of int. On balance, most
> un-parseable types are probably classes, not fundamental types.

That's super cool, thanks for the insight into why decltype(std) is replaced
with int in the first place. Is the substitution but lack of diagnostic
intentional in a case like this https://godbolt.org/z/K91j35rTs? The lack of
diagnostic is of course appreciated for code bowling :)

What's the reason why this substitution is only made in certain contexts?

Reply via email to