clang++

Travis CI with Clang 3.4 and C++11

元气小坏坏 提交于 2019-12-03 00:29:47
问题 Is it possible to get Travis CI working with Clang that is capable of C++11? (I want Clang, not GCC, I already have GCC 4.8 working in Travis CI.) It appears that the version that is there pre-installed is not C++11 capable. All my attempts at installing any newer version end up failing because of this: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:57: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/type_traits:269:39: error: use

Include search path on Mac OS X Yosemite 10.10.1

本秂侑毒 提交于 2019-12-02 21:06:57
I just to change the include search path order (I believe). I'd like to change the include search path. Especially, I need /usr/local/include first. But it doesn't change because of duplicate. How can I change it? I suppose there's default setting, because paths I don't specify appears. Like /usr/include/c++/4.2.1 , /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free

clang fails replacing a statement if it contains a macro

对着背影说爱祢 提交于 2019-12-02 18:14:37
I'm using clang to try and parse (with the C++ API) some C++ files and make all the case - break pairs use a specific style. Example : **Original** switch(...) { case 1: { <code> }break; case 2: { <code> break; } } **After replacement** switch(...) { case 1: { <code> break; } case 2: { <code> break; } } What I have so far does exactly what I want if the code parts don't contain any macros. My question is: does clang treat expanded ( if I do a dump of a problematic statement it will show the expanded version ) macros differently? if so how can I get this to work? Additional info that may help:

What's the status of C++17 support in GCC?

心已入冬 提交于 2019-12-02 17:57:00
Clang has a nice page describing the project status w.r.t. C++1z/C++17 feature support (and C++11 and C++14, it's the same page). g++ has a page regarding C++14 features , but I couldn't find anything about C++17/C++1z. Is that being worked on but just not present on the web? For version 5.0? As of today, gcc's C++1z language support is tracked on: https://gcc.gnu.org/projects/cxx1z.html . For the C++1z status of libstdc++, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.201z . There is some support already; The following two summaries are oriented on Clang's list:

What is the difference? clang++ | clang -std=c++11

怎甘沉沦 提交于 2019-12-02 17:04:48
I had been erroneously using this command, which failed at the link step: $ clang -std=c++11 -stdlib=libc++ myInputFile.cpp Can anyone explain why clang provides a C++ language option, and why it fails to link? Why don't the options -x c++ or -std=c++11 accomplish the same thing as clang++ ? Thanks! Technically, neither of the programs named clang or clang++ is a compiler: they are both drivers that analyze the input arguments and determine what compilers/assemblers/linkers to invoke on what files with what command line arguments. The only difference between the two is that clang links against

Class members reordering

Deadly 提交于 2019-12-02 15:56:19
问题 recently I've read about compiler ability to reorded members in a class. From C++ 11 standard: § 9.2.13 [...] The order of allocation of non-static data members with different access control is unspecified. I would like to know how does it look like in practice. Do the major compilers (I'm interested in g++, clang and msvc) reorder class members in some situtations? If no, is there anything else that could happen which would result in different object layout on different compilers (or when

Installed clang++3.6 on Ubuntu, can't select as alternative

跟風遠走 提交于 2019-12-02 15:54:15
I just installed clang++3.6 on my Ubuntu machine, but can't set it as the default c++ compiler. sudo update-alternatives --config c++ tells me that There is only one alternative in link group c++ (providing /usr/bin/c++): /usr/bin/g++ Nothing to configure. and clang++ doesn't show up in sudo update-alternatives --query c++ either (which was to be expected). But the compiler definitely works: which clang++-3.6 /usr/bin/clang++-3.6 My OS version is Ubuntu 14.04.1 LTS. What do I have to do to make update-alternatives include clang++3.6? Note: I previously used clang3.4, but removed it since it

How to compile C++ for Windows with clang in Visual Studio 2015

痴心易碎 提交于 2019-12-02 15:47:10
As far as I understand, Visual Studio 2015 is shipped with clang. First I though this was only for Android and iOS apps, but according to this article it should also be possible to use the clang++ frontend for Windows programs. However, I can't find the according option. So could you please explain to me, how I can change the used compiler to clang in a c++ project (in VS2015 RC Community Edition). Starting with VS2015 Update 1 you can install the "Clang with Microsoft CodeGen" template via the New Project window, browse to Installed -> Templates -> Visual C++ -> Cross Platform. You will then

Travis CI with Clang 3.4 and C++11

岁酱吖の 提交于 2019-12-02 14:06:46
Is it possible to get Travis CI working with Clang that is capable of C++11? (I want Clang, not GCC, I already have GCC 4.8 working in Travis CI.) It appears that the version that is there pre-installed is not C++11 capable. All my attempts at installing any newer version end up failing because of this : In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:57: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/type_traits:269:39: error: use of undeclared identifier '__float128' struct __is_floating_point_helper<__float128> I have seen the

clang infinite tail recursion optimization

半腔热情 提交于 2019-12-02 07:27:28
问题 #include <iostream> int foo(int i){ return foo(i + 1); } int main(int argc,char * argv[]){ if(argc != 2){ return 1; } std::cout << foo(std::atoi(argv[1])) << std::endl; } % clang++ -O2 test.cc % time ./a.out 42 1490723512 ./a.out 42 0.00s user 0.00s system 69% cpu 0.004 total % time ./a.out 42 1564058296 ./a.out 42 0.00s user 0.00s system 56% cpu 0.006 total % g++ -O2 test.cc % ./a.out 42 #infinte recursion ^C % clang++ --version clang version 3.3 (tags/RELEASE_33/final) Target: x86_64-apple