#error directive

David Aldrich david.aldrich.ntml@gmail.com
Wed Mar 6 14:51:00 GMT 2019


Hi
I have included the #error directive in my code to test for C++14 support:

#if __GNUC__ && (__cplusplus < 201402L)
    #error Requires a C++14 compliant compiler
#endif

When that condition is not met compilation gives:

main.cpp:32:3: error: #error Requires a C++14 compliant compiler
  #error Requires a C++14 compliant compiler
   ^

Is that the expected message?  The caret under #error suggests to me that
the #error line is invalid, not the condition.

Best regards

David



More information about the Gcc-help mailing list