gcc5

Why does g++5 deduces object instead of initializer_list in auto type deduction

感情迁移 提交于 2019-11-28 12:17:24
I recently came upon this code: struct Foo{}; int main() { Foo a; // clang++ deduces std::initializer_list // g++5.1 deduces Foo auto b{a}; a = b; } It compiles fine with g++5.1, but fails in clang++ (used both -std=c++11 and -std=c++14 , same results). The reason is that clang++ deduces the type of b as std::initializer_list<Foo> , whereas g++5.1 deduces as Foo . AFAIK, the type should indeed be (counter-intuitive indeed) std::initializer_list here . Why does g++5 deduces the type as Foo ? There is a proposal for C++1z that implements new type deduction rules for brace initialization ( N3922

Is my fma() broken?

半城伤御伤魂 提交于 2019-11-28 01:02:37
In using double fma(double x, double y, double z); I'd expect a non-zero d in the output lines below marked with '?' . It appears to internally only use long double precision rather than infinite precision as specified. The fma functions compute ( x × y ) + z , rounded as one ternary operation: they compute the value (as if) to infinite precision and round once to the result format, according to the current rounding mode. §7.12.13.1 2 (my emphasis) So is my fma() broken, or how am I using it incorrectly in code or compile options? #include <float.h> #include <math.h> #include <stdio.h> int

Valgrind Unrecognised instruction

久未见 提交于 2019-11-27 23:27:14
I have the following code: #include <iostream> #include <random> int main() { std::mt19937_64 rng(std::random_device{}()); std::cout << std::uniform_int_distribution<>(0, 100)(rng) << '\n'; } I try to profile it using valgrind , but it says: vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1 vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 ==2092== valgrind: Unrecognised instruction at address 0x4cdc1b5. ==2092== at 0x4CDC1B5:std::(anonymous namespace)::__x86_rdrand()

New option in GCC 5.3: -fno-semantic-interposition

懵懂的女人 提交于 2019-11-27 22:18:07
问题 GCC 5.3 has added a new option: -fno-semantic-interposition A new -fno-semantic-interposition option can be used to improve code quality of shared libraries where interposition of exported symbols is not allowed. This sounds like this is something useful for C++ projects where interposition can't be used for whatever reason, but where latency is a concern. However, the description is fairly vague. Is anyone able to clarify how this option works exactly? 回答1: -fno-semantic-interposition can

How to Install gcc 5.3 with yum on CentOS 7.2?

天大地大妈咪最大 提交于 2019-11-27 16:45:51
I am using CentOS 7.2 When I use yum groupinstall "Development Tools" , gcc version is 4.8.5, like this: I would like to install gcc 5.3 How to approach this with yum ? Update: Often people want the most recent version of gcc, and devtoolset is being kept up-to-date, so maybe you want devtoolset-N where N={4,5,6,7...}, check yum for the latest available on your system). Updated the cmds below for N=7. There is a package for gcc-7.2.1 for devtoolset-7 as an example. First you need to enable the Software Collections , then it's available in devtoolset-7: sudo yum install centos-release-scl sudo

How to Install gcc 5.3 with yum on CentOS 7.2?

≯℡__Kan透↙ 提交于 2019-11-26 22:28:30
问题 I am using CentOS 7.2 When I use yum groupinstall "Development Tools" , gcc version is 4.8.5, like this: I would like to install gcc 5.3 How to approach this with yum ? 回答1: Update: Often people want the most recent version of gcc, and devtoolset is being kept up-to-date, so maybe you want devtoolset-N where N={4,5,6,7...}, check yum for the latest available on your system). Updated the cmds below for N=7. There is a package for gcc-7.2.1 for devtoolset-7 as an example. First you need to