gcc4.9

Unpacking parameter packs in template aliases

扶醉桌前 提交于 2019-12-04 02:00:46
I run into a problem with unpacking variadic templates into a template alias. The following code works with Clang 3.4 and GCC 4.8 but fails with GCC 4.9: template <typename T, typename...> using front_type = T; template <typename... Ts> struct foo { using front = front_type<Ts...>; }; GCC 4.9 complains: test.cc:7:37: error: pack expansion argument for non-pack parameter 'T' of alias template 'template<class T, class ...> using front_type = T' using front = front_type<Ts...>; ^ test.cc:1:15: note: declared here template <typename T, typename...> ^ There exists a filed GCC bug ( #59498 ), but is

installing GCC-4.9 without root - adding paths and binaries and extra

泄露秘密 提交于 2019-12-03 13:34:04
问题 i just installed gcc 4.9 using the link here and it is a very good link. But I have only one problem which i dont want to try not to mess up --> linking the libraries and path variables. we have a cluster in our college and i installed this in my home directory (without root). Now my home/ directory contains this folder where all the gcc folders are : bin include lib lib64 libexec share What all do i have to do to point to the g++/gcc binary in bin folder with additional linking ? For example

MinGW GCC 4.9.1 and floating-point determinism

非 Y 不嫁゛ 提交于 2019-12-03 12:21:43
I wrote a small program to compute the Euclidean norm of a 3-coordinate vector. Here it is: #include <array> #include <cmath> #include <iostream> template<typename T, std::size_t N> auto norm(const std::array<T, N>& arr) -> T { T res{}; for (auto value: arr) { res += value * value; } return std::sqrt(res); } int main() { std::array<double, 3u> arr = { 4.0, -2.0, 6.0 }; std::cout << norm(arr) - norm(arr) << '\n'; } On my computer, it prints -1.12323e-016 . I know that floating point types should be handled with care. However, I thought that floating-point operations were at least somehow

How to install g++ 4.9 on Debian Wheezy armel?

拟墨画扇 提交于 2019-12-03 11:49:42
My Debian 7 armel embedded system currently has g++ 4.6, and I'd like to upgrade to g++ 4.9 to use new C++11 features. How do I do that? My current sources.list contents is: deb http://security.debian.org/ wheezy/updates main deb-src http://security.debian.org/ wheezy/updates main deb http://ftp.us.debian.org/debian wheezy main non-free deb-src http://ftp.us.debian.org/debian wheezy main non-free A simple apt-get install of the package does not work: root@arm:~# apt-get install g++-4.9 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate

installing GCC-4.9 without root - adding paths and binaries and extra

半腔热情 提交于 2019-12-03 03:36:24
i just installed gcc 4.9 using the link here and it is a very good link. But I have only one problem which i dont want to try not to mess up --> linking the libraries and path variables. we have a cluster in our college and i installed this in my home directory (without root). Now my home/ directory contains this folder where all the gcc folders are : bin include lib lib64 libexec share What all do i have to do to point to the g++/gcc binary in bin folder with additional linking ? For example, set ld_library_path, set binary paths (export PATH = /home/asdf/gcc4.9/bin:$PATH) . etc.. Can anyone

error: no match for 'operator<<' using boost::serialisation

落爺英雄遲暮 提交于 2019-12-02 06:12:45
问题 I am trying to get some (hitherto) windows code to compile on a unix machine but am getting some errors at the following method: namespace EDIN { void World::Save(char const filename[]) { std::ofstream ofs(filename); boost::archive::text_oarchive oa(ofs); oa << this << cellSequence << report; // line 590: error! } } The error looks like this: test.cpp: In member function ‘void EDIN::World::Save(const char*)’: test.cpp:122:12: error: no match for ‘operator<<’ (operand types are ‘boost::archive

error: no match for 'operator<<' using boost::serialisation

丶灬走出姿态 提交于 2019-12-02 01:28:41
I am trying to get some (hitherto) windows code to compile on a unix machine but am getting some errors at the following method: namespace EDIN { void World::Save(char const filename[]) { std::ofstream ofs(filename); boost::archive::text_oarchive oa(ofs); oa << this << cellSequence << report; // line 590: error! } } The error looks like this: test.cpp: In member function ‘void EDIN::World::Save(const char*)’: test.cpp:122:12: error: no match for ‘operator<<’ (operand types are ‘boost::archive::text_oarchive’ and ‘EDIN::World*’) oa << this << cellSequence << report; // line 590: error! ^ test

g++4.9 and g++5 different behaviour when narrowing in initializing list

走远了吗. 提交于 2019-11-30 09:21:05
问题 Consider this code: #include <iostream> int main() { int i{10.1}; // narrowing, should not compile std::cout << i << std::endl; } According to the C++11 standard, it should not compile (narrowing in brace initialization is forbidden.) Now, compiling with g++4.9.2 -std=c++11 only emits a warning warning: narrowing conversion of '1.01e+1' from 'double' to 'int' inside { } [-Wnarrowing] Removing the -std=c++11 flag results in a warning regarding the brace init, but not any narrowing: warning:

Is memcpy(&a + 1, &b + 1, 0) defined in C11?

余生颓废 提交于 2019-11-30 07:45:14
问题 This question follows this previous question about the definedness of memcpy(0, 0, 0) , which has been conclusively determined to be undefined behavior. As the linked question shows, the answer hinges on the contents of C11's clause 7.1.4:1 Each of the following statements applies unless explicitly stated otherwise in the detailed descriptions that follow: If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address

Can you mix c++ compiled with different versions of the same compiler

假装没事ソ 提交于 2019-11-29 23:03:13
For example could I mix a set of libraries that have been compiled in say GCC-4.6 with GCC-4.9. I'm aware different compilers "breeds" such as VS cannot be with MinGW but can different generations of the same compiler? Are issues likely to occur? If so what? Different generations of the same compiler sometimes can be compatible with each other, but not always. For example, GCC 4.7.0 changed its C/C++ ABI , meaning libraries compiled with 4.7.0+ and 4.7.0- are not likely to be compatible with each other (so in your example, the library compiled with 4.6 will not be compatible with the library