铛+ VS2013:错误时,包括C ++头(vs2012:工作)(Clang+VS2013: err

2019-10-19 03:07发布

编辑

我发现http://llvm.org/docs/GettingStartedVS.html

正因为如此,铛无法解析C ++随Visual Studio,也不是Windows平台SDK的部分标准库。

因此,如果没有使用Visual Studio头支持C ++,我应该还是写一个错误报告?

问:

我安装铛的Visual Studio工具链http://llvm.org/builds/ 。 使用VS2013,我编译任何C ++头时,得到的几个误区。 例如:

#include <memory>

int main()
{
    return 0;
}

这些错误似乎与微软的C ++ 14的实现。 这并不在Visual Studio 2012年发生切换到LLVM工具链,vs2012在VS2013也适用

错误使用VS2013 + LLVM-vs2013:

1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>clang-cl.exe : warning : argument unused during compilation: '/ZI'
1>clang-cl.exe : warning : argument unused during compilation: '/Gm'
1>clang-cl.exe : warning : argument unused during compilation: '/EHsc'
1>clang-cl.exe : warning : argument unused during compilation: '/GS'
1>clang-cl.exe : warning : argument unused during compilation: '/fp:precise'
1>clang-cl.exe : warning : argument unused during compilation: '/Ycstdafx.h'
1>clang-cl.exe : warning : argument unused during compilation: '/FpDebug\ConsoleApplication1.pch'
1>clang-cl.exe : warning : argument unused during compilation: '/FdDebug\vc120.pdb'
1>clang-cl.exe : warning : argument unused during compilation: '/Gd'
1>clang-cl.exe : warning : argument unused during compilation: '/ZI'
1>clang-cl.exe : warning : argument unused during compilation: '/Gm'
1>clang-cl.exe : warning : argument unused during compilation: '/EHsc'
1>clang-cl.exe : warning : argument unused during compilation: '/GS'
1>clang-cl.exe : warning : argument unused during compilation: '/fp:precise'
1>clang-cl.exe : warning : argument unused during compilation: '/Yustdafx.h'
1>clang-cl.exe : warning : argument unused during compilation: '/FpDebug\ConsoleApplication1.pch'
1>clang-cl.exe : warning : argument unused during compilation: '/FdDebug\vc120.pdb'
1>clang-cl.exe : warning : argument unused during compilation: '/Gd'
1>  In file included from ConsoleApplication1.cpp:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0:9:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility:8:
1>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\utility:8:
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(620,32): error : '_Ty' does not refer to a value
1>                  : _Cat_base<_IS_CONSTRUCTIBLE(_Ty, _Args...)>
1>                                                ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(617,15) :  note: declared here
1>  template<class _Ty,
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(621,1): error : expected class name
1>          {       // determine whether _Ty(_Args...) is constructible
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(746,19): error : '_Ty' does not refer to a value
1>                  _IS_DESTRUCTIBLE(_Ty)
1>                                   ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(48,31) :  note: expanded from macro '_IS_DESTRUCTIBLE'
1>          : _Cat_base<__is_destructible(_Ty)>
1>                                        ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(744,15) :  note: declared here
1>  template<class _Ty>
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(747,1): error : expected class name
1>          {       // determine whether _Ty has a destructor
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(887,40): error : '_Ty' does not refer to a value
1>                  : _Cat_base<_IS_NOTHROW_CONSTRUCTIBLE(_Ty, _Args...)>
1>                                                        ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(884,15) :  note: declared here
1>  template<class _Ty,
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(888,1): error : expected class name
1>          {       // determine whether _Ty(_Args...) is nothrow constructible
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(951,25): error : '_To' does not refer to a value
1>                  _IS_NOTHROW_ASSIGNABLE(_To, _From)
1>                                         ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(50,37) :  note: expanded from macro '_IS_NOTHROW_ASSIGNABLE'
1>          : _Cat_base<__is_nothrow_assignable(_To, _From)>
1>                                              ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(947,15) :  note: declared here
1>  template<class _To,
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(953,1): error : expected class name
1>          {       // determine whether _From can be assigned to _To, nothrow
1>          ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1000,27): error : '_Ty' does not refer to a value
1>                  _IS_NOTHROW_DESTRUCTIBLE(_Ty)
1>                                           ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(52,39) :  note: expanded from macro '_IS_NOTHROW_DESTRUCTIBLE'
1>          : _Cat_base<__is_nothrow_destructible(_Ty)>
1>                                                ^
1>  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(997,15) :  note: declared here
1>  template<class _Ty>
1>                 ^
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\type_traits(1002,1): error : expected class name
1>          {       // determine whether _Ty has a nothrow destructor
1>          ^
1>  10 errors generated.

运行clang -v在命令行上输出

clang version 3.4 (195641)
Target: i686-pc-win32
Thread model: posix

可以任你重现此错误? 如果是的话,我会创造在一个bug报告http://llvm.org/bugs/ 。

Answer 1:

该缺陷正在这里追踪: http://llvm.org/bugs/show_bug.cgi?id=17926

有关进一步信息注释部分。



文章来源: Clang+VS2013: error when including c++ header (vs2012:working)