Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

not working for clang++ 10.0.0 or g++ 9.3.0 #1

@jhgorse

Description

@jhgorse

Compile dies upon include. Here are the clang++ results:

./upptest.h:97:15: error: exception specification of overriding function is more lax than base version
                const char* what() const override { return _msg.c_str(); }
                            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/exception.h:75:5: note: overridden virtual function is here
    what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
    ^
1 error generated.

g++ results:

In file included from play.cpp:5:
upptest.h:97:15: error: looser throw specifier for ‘virtual const char* utest::assert_fail_exception::what() const’
   97 |   const char* what() const override { return _msg.c_str(); }
      |               ^~~~
In file included from /usr/include/c++/9/exception:38,
                 from upptest.h:51,
                 from play.cpp:5:
/usr/include/c++/9/bits/exception.h:75:5: note: overridden function is ‘virtual const char* std::exception::what() const noexcept’
   75 |     what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
      |     ^~~~
In file included from play.cpp:5:
upptest.h:146:15: error: declaration of ‘const utest::info* utest::result::info’ changes meaning of ‘info’ [-fpermissive]
  146 |   const info* info;
      |               ^~~~
upptest.h:114:8: note: ‘info’ declared here as ‘class utest::info’
  114 |  class info;
      |        ^~~~
upptest.h:147:10: error: declaration of ‘utest::status utest::result::status’ changes meaning of ‘status’ [-fpermissive]
  147 |   status status;
      |          ^~~~~~
upptest.h:107:13: note: ‘status’ declared here as ‘enum class utest::status’
  107 |  enum class status
      |             ^~~~~~

The errors are the same for -std=c++11 with more that follow.

Cheers,
Joe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions