Eclipse CDT complains that the following is syntactically wrong, although it compiles fine with g++-7 -std=c++17
:
static_assert(std::is_pod<T>::value);
while it doesn't complain on the following:
static_assert(std::is_pod<T>::value, "not a POD");
I realize that the prior to C++17 static_assert
required a second message parameter.
I'm curious if Eclipse could be configured to recognize the first form? (A workaround is of course to use the C++11 form.)
On a side note, g++ 7.1 is OK with both forms, even with -std=c++11
.
Thanks!
Eclipse CDT does not yet have any C++17 support, so it does not recognize this form of static_assert
.
You could work around this by defining the following macro in your code:
#define static_assert(cond) static_assert(cond, "")
If your compiler objects to this, you can condition it on the __CDT_PARSER__
macro, so that only CDT sees it, not your compiler:
#ifdef __CDT_PARSER__
#define static_assert(cond) static_assert(cond, "")
#endif
If you prefer to apply this workaround without modifying your source files, you could also define this macro in Project Properties | C/C++ General | Preprocessor Include Paths, Macros etc. | GNU C++ | CDT User Setting Entries
.