Error when using static_assert on Netbeans

左心房为你撑大大i 提交于 2019-12-08 03:30:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!