https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119923
Bug ID: 119923 Summary: `-pedantic-errors` should imply `-fno-ms-extensions` on MinGW Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamsupermouse at mail dot ru Target Milestone: --- GCC on Windows has a relatively little-known flag `-fno-ms-extensions`, which disables some problematic MSVC-like extensions, which aren't otherwise disabled even by `-std=c++?? -pedantic-errors`. Here are two examples of things `g++ -std=c++26 -pedantic-errors` allows on MinGW, and that `-fno-ms-extensions` rejects: template <typename T> foo() {return 42;} // Missing return type. struct A {void blah() {}}; auto ptr = A::blah; // Missing `&`. I suggest that `-fno-ms-extensions` should be enabled by default if `-pedantic-errors` is used. For comparison, Clang in MinGW mode doesn't allow neither of those, and I couldn't find any flag to enable them. I've been using it for some time, and those missing extensions never came up as an issue. Clang ignores `-f[no-]ms-extensions` in MinGW mode entirely. In MSVC-compatible mode this flag is harmful, as it disables `__declspec(dllexport)` and friends, unless enabled separately via `-fdeclspec`.