Clang + VS2013:包含c ++标题时出错(vs2012:working)

时间:2013-12-14 03:02:34

标签: c++ visual-studio-2012 clang visual-studio-2013

修改

我找到了http://llvm.org/docs/GettingStartedVS.html

  

因此,clang无法解析包含的C ++标准库   使用Visual Studio,也不是Windows Platform SDK的一部分。

因此,如果Visual Studio标头不支持C ++,我还应该编写错误报告吗?

问:

我从http://llvm.org/builds/安装了clang visual studio工具链。 使用VS2013,编译任何c ++标头时会出现几个错误。 例如:

#include <memory>

int main()
{
    return 0;
}

这些错误似乎与microsofts c ++ 14实现有关。 在Visual Studio 2012中不会发生这种情况。 在VS2013中切换到工具链 LLVM-vs2012 也可以正常工作

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

你们有没有重现这个错误?如果是,我会在http://llvm.org/bugs/创建一个bug报告。

1 个答案:

答案 0 :(得分:2)

此处正在跟踪错误:http://llvm.org/bugs/show_bug.cgi?id=17926

有关详细信息,请参阅评论部分。