g++ doesn't diagnose implicit int error

Keith Thompson Keith.S.Thompson@gmail.com
Tue Jun 11 07:48:00 GMT 2019


I believe this answer by user "M.M" on Stack Overflow explains the issue:
https://stackoverflow.com/a/56537459/827263

On Windows targets (including Cygwin and MinGW), the "-fms-extensions"
option is enabled by default.  This option enables certain Microsoft
extensions -- and apparently inhibits any diagnostics for implicit int.

It is unfortunate, and arguably a bug, that this means that
"g++ -std=c++11 -pedantic" fails to diagnose implicit int errors.
I'm not sure whether this is a bug in gcc or in the way Windows
versions of gcc are built.

Meanwhile, this can be worked around by using "g++ -fno-ms-extensions ...".
This which might cause problems when compiling some Windows headers,
but M.M reports being able to compile some large Windows projects
this way without running into problems.

There's also a "-fms-extensions" option for C, but gcc warns about
implicit int declarations in C with or without that option.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list