Questions tagged [gcc7]

GCC 7 is a major release of the GNU Compiler collection first released in 2017.

Version 7.1. was released on 2017-05-02. Version 7.5 was released on 2019-11-14.

See also:

74 questions
4
votes
1 answer

GCC 7 compilation error when using std::addressof

I am observing some strange behavior that I can't quite explain myself. The code looks like this: #include #include #include int main(){ std::vector t1(10, 5.0); std::vector t2(10); …
hassec
  • 686
  • 4
  • 18
3
votes
1 answer

Does GCC 7.3 contain all c++17 features?

I'm trying to build CMake project that use c++17 dialect with the CMake command: set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF ) I see that it set the compiler flag "-std=c++1z", but I still getting…
3
votes
2 answers

Why I'm getting std::bad_variant_access with std::variant?

Consider: #include #include int main() { double foo = 666.666; std::variant v = foo; std::cout << std::get(v) << std::endl; return 0; } This results in: terminate called after…
juzzlin
  • 45,029
  • 5
  • 38
  • 50
3
votes
1 answer

Will std::basic_string destroy null termination every time?

Recently, I update my compiler from gcc-4.3.x to gcc-7.x, and then meet an Assert exception for one of my tester. The code looks like: struct data { data() : _c(0) { ++CREATED; std::cout<<"data CREATED +1"<<_c<<" addres: "<<&_c<
Maolin Tu
  • 33
  • 3
3
votes
0 answers

C++ support of _Float16

I want to do half-precision floating-point computations on Jetson AGX Xavier(with armv8.2 architecture) which supports half-precision floating-point natively. As _Float16 data type is an arithmetic data type for half-precision floating-point, I…
Sooora
  • 171
  • 9
3
votes
1 answer

Cannot use C libraries that include math.h with g++ 7 (Raspberry PI)

I've built GCC 7.2.0 for Raspberry PI, and installed it with prefix /usr/local/gcc-7.2.0 (using this tutorial). Whenever I try to compile a source that includes a C library that in turn includes math.h I get strange errors. Below is a minimal…
Azad Salahli
  • 876
  • 3
  • 14
  • 30
3
votes
1 answer

gcc gives no warning for comparing unsigned integer < 0 even with Wextra enabled

Take the following code #include template T f(T x, unsigned y) { if (y < 0) return x; return static_cast(0); } using namespace std; int main() { int a = f(2, 3); std::cout << a << std::endl; return…
jureslak
  • 195
  • 2
  • 9
3
votes
1 answer

How does `std::mem_fn` detect noexceptness in gcc 7.1.0

With gcc 7.1.0 std::mem_fn is able to detect noexcept-ness on a member function pointer. How does it do this? I thought the noexcept specifier was not a part of the function type? What is even more confusing is when I remove the noexcept…
Curious
  • 20,870
  • 8
  • 61
  • 146
2
votes
2 answers

Is there a technique for named instances of an anonymous struct to reference functions inside the enclosing class?

I have a CRTP class where for API clarity during refactoring, I want to have a named anonymous struct containing methods, instead of having all methods at class scope. The problem is, these methods need access to the outer scope. For…
Chuu
  • 4,301
  • 2
  • 28
  • 54
2
votes
1 answer

Can't compile with gcc-7

I am trying to compile some code with GCC-7 on MacOS Catalina. The GCC-7 was installed using homebrew brew install gcc@7 The code is the following: #include #include double distance(double *a, double *b, int d) { double…
sted
  • 83
  • 9
2
votes
1 answer

clang version 6.0.0 : clang++ "no member named 'make_optional' in namespace 'std' "

Till now I've been using gcc for compiling my C++ code in Ubuntu 16.04 server edition. But since the latest features of C++17 (mainly concurrency and parallelism) are not convered by the latest gcc, while in clang many of them are, I've been…
user2315094
  • 759
  • 3
  • 16
  • 29
2
votes
1 answer

Linking error with gcc/g++ 7.3.0 on ubuntu 18.04

I have a project where I link to the BLAS library using the -lcblas flag. It used to compile fine, until after upgrading my system to Ubuntu 18.04 and GCC 7.3.0. Anyway, the compile command is g++ -o @$ benchmark.o mine.o -lcblas which yields the…
Adrian
  • 25
  • 1
  • 3
2
votes
0 answers

Building Gktmm 3.91 from source using gcc 7

OS : Ubuntu 16.04 LTS Compiler : Gcc7.2 I want to add Gtkmm3.9 as a third party dependency for one of my project and I try to compile from the source. I'm not familiar with autoconf or automake toolset. Going through the documentation…
2
votes
1 answer

std::async with gcc 7.2 need pthread link option

The following code need pthread link option to compile, and i don't understand why. Do you have any idea? I'm using gcc 7.2.0 #include int sum = 0; void func() { for(int i=0; i < 10; ++i) sum +=i; } int main() { …
bonpiedlaroute
  • 173
  • 1
  • 9
2
votes
1 answer

libstdc++ static linking & System V ABI

When I compile with -static-libstdc++, compiled binary uses UNIX - GNU ABI, but I need to get a binary with UNIX - System V ABI. (I need a compatibility with FreeBSD) I also tried Compile libstdc++ with hash style SYSV, but it doesn't help. $…
Artem
  • 91
  • 8