草庐IT

clang-omp

全部标签

c++ - 使用 clang++/libc++ 删除 Boost libstdc++ 依赖项?

这个问题的答案Howtocompile/linkBoostwithclang++/libc++?说明要使用clang++和libc++构建Boost,应执行以下操作:./b2clean./b2toolset=clangcxxflags="-stdlib=libc++"linkflags="-stdlib=libc++"我在ScientificLinux6.4x86_64主机上测试了上面的技巧,它“大部分”都在构建完整的Boost1_53_0发行版,使用clang++3.3sv和libc++3.3svn.我主要是说,因为我真的很想删除所有libstdc++依赖项。然而,以下内容:libb

c++ - Clang 与 GCC 与 MSVC 中的 SFINAE 和可见性检查——哪个是正确的?

我已经写了我对is_default_constructible的C++03兼容实现的尝试:templatestructis_default_constructible;templatestructis_default_constructible{protected://Putbasetypedefsheretoavoidpollutionstructtwoc{chara,b;};templatestructtest{typedefchartype;};templatestaticTdeclval();};templatestructis_default_constructible::t

c++ - 为什么将影响 lambda 的代码编译为 std::function 如此缓慢,尤其是使用 Clang 时?

我发现相对少量代码的编译时间,将lambda函数转换为std::function值,可以非常高,尤其是使用Clang编译器时。考虑以下创建100个lambda函数的虚拟代码:#ifMODE==1#includeusingLambdaType=std::function;#elifMODE==2usingLambdaType=int(*)();#elifMODE==3#include"function.h"//https://github.com/skarupke/std_functionusingLambdaType=func::function;#endifstaticinttota

c++ - CppUnit 在 Mac OS X 上与 Clang 链接错误

我正在尝试使用CppUnit编译测试程序。问题是,使用此示例代码://[...]classEntityComponentTest:publicCppUnit::TestFixture{CPPUNIT_TEST_SUITE(EntityComponentTest);CPPUNIT_TEST(testGetComponents);CPPUNIT_TEST_SUITE_END();Entitye;public:voidsetUp(){e.addComponent("1",newTestComponent("Hello1"));e.addComponent("2",newTestCompone

c++ - 为什么 clang 会发出这些警告?

clang编译器针对下面的代码片段发出警告,可以看出here.clang++-std=c++14-O0-Wall-pedantic-pthreadmain.cpp&&./a.outmain.cpp:1:18:warning:bracesaroundscalarinitializer[-Wbraced-scalar-init]voidpoint(int={1},int={2}){}^~~main.cpp:1:29:warning:bracesaroundscalarinitializer[-Wbraced-scalar-init]voidpoint(int={1},int={2}){}^

c++ - constexpr 静态模板函数 : g++ error is a warning on clang

考虑以下片段:#includetemplateconstexprintf(){returnI*f();}templateconstexprintf(){return1;}intmain(){std::cout();return0;}这段代码可以很好地与g++和clang编译。非常好。现在将static添加到模板函数特化中:templateconstexprstaticintf(){return1;}然后g++6.1响应错误:11:error:explicittemplatespecializationcannothaveastorageclass还有clang3.8:11:error:

c++ - Clang 构建错误

我正在尝试在Ubuntu16.04上构建clang主干,但无论我尝试什么,我都会遇到构建错误。首先,我针对gcc5.4构建了llvm/clang/libc++/libc++abi,这工作正常。现在我正在尝试使用我刚刚构建的clang来重建llvm/clang/libc++/libc++abi。此操作失败并显示以下错误消息:[162/4396]LinkingCXXexecutablebin/llvm-tblgenFAILED::&&/usr/local/bin/clang++-stdlib=libc++-fPIC-fvisibility-inlines-hidden-Wall-W-Wno

c++ - Clang 如何编译模板实例化?

我正在使用Clang作为一个库来编译一些模板代码:templateTgetSevenTemplated(){return7;}intgetSeven(){returngetSevenTemplated();}不幸的是,编译后的LLVMIR实际上并不包含getSevenTemplated的实现。:;ModuleID='./test.cpp'source_filename="./test.cpp"targetdatalayout="e-m:o-i64:64-f80:128-n8:16:32:64-S128"targettriple="x86_64-apple-macosx10.12.0";

c++ - 从右值引用到基的构造函数 - 可行(gcc)或不可行(clang) - 谁是对的

最近有一个编译问题,用这个片段说明:structBase{};templatestructA:Base{A(){}A(Base&&){}};Afoo(){Av;returnv;}intmain(){autod=foo();return0;}Gcc说没问题,但clang不同意并说“候选构造函数不可行:对于第一个参数A(Base&&){},没有已知的从‘A’到‘Base&&’的转换”,请自行查看:https://godbolt.org/z/Y7mwnU有哪位好心的读者能够提供一些标准术语来支持这两种观点吗? 最佳答案 clang在这里是

c++ - 无法在带有 Clang 的模块中使用对齐的 `operator new`

我正在试验Clang的“模块”功能,我正在尝试编译以下代码:exportmodulea;#includeexportvoid*foo(){return::operatornew(1,std::align_val_t(1));}exportintmain(){}Tryitlive当我尝试clang++-std=c++2a-pedantic-errors-fmodules-ts--precompile-xc++-modulea.cpp-oa.pcm,我得到了error:ISOC++requiresadefinitioninthistranslationunitforfunction'ope