C++ 17 features in Visual Studio 2015 with Clang

这一生的挚爱 提交于 2020-01-23 03:32:53

问题


This is a perennial question here, but: does anyone know if there is a way to get Visual Studio 2015, with the Clang tool chain installed (tab for "cross compilation") to enable the 2017 features that Clang itself normally supports?

For example, I would like this to compile:

constexpr bool test(bool a){bool b= false; b = b || a; return b;}
static_assert(test(true),"");

With Clang itself, version 3.7, from command line with --std=++1z, this will compile correctly, but Visual Studio C++ is not yet at the level of supporting the full range of constexpr function features. I had hoped that by cross compiling with Clang it would take them, but no luck. I see that under properties, I'm only able to enable up through C++ 14 -- is this the core problem? Namely that the visual studio parser itself at the IDE level can't yet understand the full constexpr functionality, even though the Clang compiler would actually compile it correctly?

来源:https://stackoverflow.com/questions/39661457/c-17-features-in-visual-studio-2015-with-clang

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