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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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.

Reply via email to