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

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #3 from Harald van Dijk <harald at gigawatt dot nl> ---
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>
    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.

(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>.)

Reply via email to