Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion 'nothrow' clashes with libstdc++ declaration #648

Open
JonasToth opened this issue Dec 3, 2024 · 0 comments
Open

Assertion 'nothrow' clashes with libstdc++ declaration #648

JonasToth opened this issue Dec 3, 2024 · 0 comments

Comments

@JonasToth
Copy link

Expected Behavior

As the example demonstrate, exception tests can be performed using the nothrow function. This should work as documented, without full namespace qualification, but doesn't.

It would be great if a non-ambiguous version of nothrow is provided, maybe throwsnot or so?
As workaround it is always possible to use a using namespace boost; ut::nothrow(); version of your code.
At least the documentation should be copy-pastable.

Actual Behavior

The nothrow is ambiguous with std::nothrow

Steps to Reproduce the Problem

#include <boost/ut.hpp>
#include <memory>

int main(int argc, char **argv) {
  using namespace boost::ut;
  using namespace std;

  "simplest_usage"_test = [] {
    // Does compile.
    expect(boost::ut::nothrow([] {}));
    // Does not compile.
    expect(nothrow([] {}));
  };
  return EXIT_SUCCESS;
}

Compiler Errors (its german, but effectively ambigous definition bla)

../src/GPIO/Wiring.test.cpp:8:39: Fehler: Referenz auf »nothrow« ist mehrdeutig
    8 |   "simplest_usage"_test = [] { expect(nothrow([] {})); };
      |                                       ^~~~~~~
In Datei, eingebunden von ../src/GPIO/Wiring.test.cpp:1:
/home/jonas/.conan2/p/boosta5a53d3219b46/p/include/ut-2.1.0/include/boost/ut.hpp:3014:30: Anmerkung: Kandidaten sind: »template<class TExpr> constexpr auto boost::ext::ut::v2_1_0::nothrow(const TExpr&)«
 3014 | [[nodiscard]] constexpr auto nothrow(const TExpr& expr) {
      |                              ^~~~~~~
In Datei, eingebunden von /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/stl_iterator.h:75,
                 von /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/stl_algobase.h:67,
                 von /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/algorithm:60,
                 von /home/jonas/.conan2/p/boosta5a53d3219b46/p/include/ut-2.1.0/include/boost/ut.hpp:75:
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/new:104:26: Anmerkung:                  »const std::nothrow_t std::nothrow«
  104 |   extern const nothrow_t nothrow;
      |                          ^~~~~~~

Specifications

  • Version: 2.1.0, installed with conan
  • Platform: Gentoo Linux, GCC-14.2.1 (compile from latest commit of the branch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant