cirosantilli/parsec-benchmark

C++11 specific code in bodytrack fails to build with "error: overriding 'virtual const char* std::exception::what() const throw ()'"

Hnefi opened this issue · 3 comments

Hnefi commented

When building bodytrack on a QEMU-emulated aarch64, I receive the following error:
$ parsecmgmt -a build -p parsec.bodytrack

In file included from /home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.cpp:21:0:
/home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.h:48:5: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++0x-compat]
     virtual const char *what() const noexcept {return "Error creating thread";}
     ^
/home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.h:48:32: error: expected ';' at end of member declaration
     virtual const char *what() const noexcept {return "Error creating thread";}
                                ^
/home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.h:48:38: error: 'noexcept' does not name a type
     virtual const char *what() const noexcept {return "Error creating thread";}
                                      ^
/home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.h:48:38: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
/home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.h:48:25: error: looser throw specifier for 'virtual const char* threads::ThreadCreationException::what() const'
     virtual const char *what() const noexcept {return "Error creating thread";}
                         ^
In file included from /usr/include/c++/5/typeinfo:34:0,
                 from /home/qflex/parsec-benchmark/pkgs/apps/bodytrack/src/TrackingBenchmark/threads/Thread.cpp:20:
/usr/include/c++/5/exception:68:25: error:   overriding 'virtual const char* std::exception::what() const throw ()'
     virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;

This is easily fixeable by just adding -std=c++11 to in /path/to/src/configure.ac

Ahh, related issue: #2

I had moved the code to c++11 because all newer compilers set it, but setting -std=c++98 was also a solution.

Thanks for this.

What GCC / OS version are you using BTW? Guessing it is old since uses c++98 by dfeault? If so, I would double check that you can't do it with a newer compiler which might give more relevant performance results 👍

Hnefi commented

Compiler/OS details were in PR #7 . Ubuntu 16.04, gcc-5.4.0

Thanks!