clang++

How is P0522R0 breaking code?

混江龙づ霸主 提交于 2021-01-29 07:11:57
问题 Today I was reading the C++17 support page of clang. I've notice something odd. The feature Matching template template parameters to compatible arguments (P0522R0) is marked as partial, because it must be activate through a switch. Their note says: Despite being the the resolution to a Defect Report, this feature is disabled by default in all language versions, and can be enabled explicitly with the flag -frelaxed-template-template-args in Clang 4. The change to the standard lacks a

Implicitly defined constructor deleted due to variant member, N3690/N4140 vs N4659/N4727

纵饮孤独 提交于 2021-01-27 12:12:32
问题 My story starts off the same as this person's here: Unions in C++11: default constructor seems to be deleted The resolution here (now about three years old) is a bit unsatisfactory, because the "Digging into the standard" that the author did ended up with concluding that the behavior was as described in the standard, but unfortunately the quote is from a Note , and those are supposed to be non-normative (I've been told). Anyways, there's a link to an old bug report on gcc that is claimed to

How to use boost::multiprecision::float128 in with Xcode

痴心易碎 提交于 2021-01-27 12:11:25
问题 I am trying to use boost::multiprecision::float128 in xCode project. My compiler version is Apple clang version 11.0.0 (clang-1100.0.20.17) Target: x86_64-apple-darwin18.7.0 Thread model: posix I am using boost.1.71.0 I am getting following compile error 'quadmath.h' file not found in float128.hpp extern "C" { #include <quadmath.h> } I saw several threads regarding to this issue https://svn.boost.org/trac10/ticket/8265 19 months ago by John Maddock (clang has no support for float128 and

Do compilers optimize out net zero bit shifts?

允我心安 提交于 2021-01-27 04:12:37
问题 I have some code like the following code block (I am not allowed to post the original code) inside a .cpp file that I think is being compiled by clang++ ( Ubuntu clang version 3.5.2-3ubuntu1 (tags/RELEASE_352/final) (based on LLVM 3.5.2) ). It looks like C code, because we are using GoogleTest for testing our C code. Anyways: size_t const SHIFT = 4; uint8_t var, var2; /* Omitted: Code that sets var to, say 00011000 (base 2) */ var2 = var; var = var << SHIFT >> SHIFT; // [1] result is 00011000

Do compilers optimize out net zero bit shifts?

主宰稳场 提交于 2021-01-27 04:11:11
问题 I have some code like the following code block (I am not allowed to post the original code) inside a .cpp file that I think is being compiled by clang++ ( Ubuntu clang version 3.5.2-3ubuntu1 (tags/RELEASE_352/final) (based on LLVM 3.5.2) ). It looks like C code, because we are using GoogleTest for testing our C code. Anyways: size_t const SHIFT = 4; uint8_t var, var2; /* Omitted: Code that sets var to, say 00011000 (base 2) */ var2 = var; var = var << SHIFT >> SHIFT; // [1] result is 00011000

Is there a `clang++:-Wunused-lambda-capture` equivalent warning in/being developed for GCC?

旧城冷巷雨未停 提交于 2021-01-05 07:58:46
问题 Background I sometimes run into code that use the following dummy lambda-capture (instead of e.g. (void)x; , ... foo(int /* x */) or ... foo([[maybe_unused]] int x) in C++17) in order to remedy an unused variable warning: void foo(int x) { [&x]{}(); } Now, this is not really a remedy, as it passes the warning over from the current scope to the lambda capture instead, but afaik, GCC has no diagnostic to flag this, whereas e.g. Clang (as of 5.0) emits the unused-lambda-capture warning, if

Cannot cross-compiling code using clang++

一个人想着一个人 提交于 2020-12-15 05:01:47
问题 Command: I am trying to cross compile a simple C++ program using clang++. I'm using Linaro gcc tool-chain to obtain the library and other includes required. ${root}/bin/clang++ --target=arm-linux-gnueabihf --rtlib=compiler-rt --stdlib=libc++ -nostdinc++ -I${root}/include/c++/v1 -Wl,-L${root}/lib --sysroot ${sysroot} --gcc-toolchain=/home/user/Tejas/LLVM/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf -rpath ${root}/lib TestCodeX86toARM.cpp -o Test -v The value of root and sysroot is as

C++20 #import “”-statement: Will it be possible to use multiple preprocessed header files

做~自己de王妃 提交于 2020-12-13 03:35:55
问题 In C++20 it is possible to instead of include headers with #include "header.h" use #import "header.h" // Edit: this is not standard see comments (this is for old code that cannot fully be converted to modules and use the normal import keyword without #) My question is about preprocessing. For a long time it as only been possible to precompile and use one header per translation unit. (Clang seems to have some special case with cascading include files, that I do not consider here) Will it be

How to include multiple precompiled headers in with c++20 (with modules enabled) in gcc or clang

China☆狼群 提交于 2020-12-12 05:39:51
问题 In c++20, when enabling modules, each include is supposed to be encapsulated so that the ordering does not matter, and macros does not leak out etc. Apparently the question if it is possible to precompile multiple headers is yes. My question now is: How do you do this: That is: How do i first precompile a set of headers and then make the compiler recognize them (all of them) as precompiled headers for my translation unit using c++20 modules, (using linux command line). I would like to have