https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102775
Sam James <sjames at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sjames at gcc dot gnu.org --- Comment #4 from Sam James <sjames at gcc dot gnu.org> --- (In reply to Harald van Dijk from comment #3) > Here is another example: > > $ cat test.cc > struct S { > int32_t i; > } s; > int main() { > return s.i; > } > $ g++ -c test.cc > test.cc:2:3: error: ‘int32_t’ does not name a type > 2 | int32_t i; > | ^~~~~~~ > test.cc:1:1: note: ‘int32_t’ is defined in header ‘<cstdint>’; this is > probably fixable by adding ‘#include <cstdint>’ > +++ |+#include <cstdint> I don't see how this is an example because it's demonstrating a fixit being emitted. The bug is requesting that in more cases. > 1 | struct S { > test.cc: In function ‘int main()’: > test.cc:5:12: error: ‘struct S’ has no member named ‘i’ > 5 | return s.i; > | ^ > > The second diagnostic is useless here, ideally GCC would continue after the > first error as if S had been defined with a valid definition of the i field. > I think you're requesting something different to this bug. > (Incidentally, the fix-it here also looks wrong. <cstdint> is not required > to make types available in the global namespace. It should either suggest > <cstdint> with std::int32_t, or <stdint.h>.) There's another bug for that I can't find right now.