问题
I use Netbeans to develop a Java / JNI / C++ application. In my c++ classes, I use static_assert and Netbeans displays an error:
static_assert(myvariable == 2, "My test.") ;
The error is:
Unable to resolve identifier static_assert
And yes, I've included "type_traits".
But, the code compiles and runs perfectly. Is that a bug from NetBeans?
回答1:
I've used C++ on NetBeans for many months now, and it appears to be one of the many bugs of NetBeans with C++. Many times, static_assert or other functions were labeled red as an error, but compiled perfectly. I will edit if this bug is fixed in a future NetBeans release.
[EDIT] it also happens with template<typename T> typename std::enable_if<std::is_same<T, INT32>::value>::type
. ::type
is flagged as being an error, but everything compiles fine.
来源:https://stackoverflow.com/questions/33114225/error-when-using-static-assert-on-netbeans