I am trying to compile some nonconforming code in c++17 but am stuck at the with the following issue.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-fpermissive"
Some code that compiles only when with -fpermissive flag is set
#pragma GCC diagnostic pop
compiles fine on gcc version 4.6.4 through 4.7.4, but all later versions of gcc are giving me the following warning and don't suppress the error.
warning: ‘-fpermissive’ is not an option that controls warnings [-Wpragmas]
#pragma GCC diagnostic ignored "-fpermissive"
When I write (out of desperation)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-fpermissive"
Some code that compiles only when with -fpermissive flag is set
#pragma GCC diagnostic pop
I am back at square one. Currently I'd like to continue using gcc 7.1 for the project. I can compile the entire project with -fpermissive flag set as a compile option but this means that some other section of code causing a -fpermissive error could compile.
Condensed example https://godbolt.org/g/KFd5Ke
This question is not a duplicate of In gcc, how to mute the -fpermissive warning? as this is directed toward newer versions of gcc where the solution provided in the aformentioned So question does not work. I even included an example.