Re: #error directive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 6 Mar 2019 at 14:51, David Aldrich <david.aldrich.ntml@xxxxxxxxx> wrote:
>
> 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.

The condition isn't invalid though. It's perfectly valid C++, it just
happens to evaluate to false. That's not invalid.

The error comes from the #error directive, so that's the location shown.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux