#include <functional>
#include <utility>
#include <string_view>
-#include <stdexcept>
#include <testsuite_hooks.h>
{ return arg.v; }
};
+struct NegativeArgument {};
+
struct ThrowFunc
{
static constexpr int
operator()(int i, int j)
{
if (i < 0 || j < 0)
- throw std::invalid_argument("negative");
+ throw NegativeArgument();
return i + j;
}
};
try {
std::cw<ThrowFunc{}>(std::cw<-1>, std::cw<1>);
VERIFY(false);
- } catch (const std::invalid_argument&) {
+ } catch (const NegativeArgument&) {
VERIFY(true);
}
}
operator[](int i, int j)
{
if (i < 0 || j < 0)
- throw std::invalid_argument("negative");
+ throw NegativeArgument();
return i * j;
}
};
try {
std::cw<ThrowIndex{}>[std::cw<-1>, std::cw<1>];
VERIFY(false);
- } catch (const std::invalid_argument&) {
+ } catch (const NegativeArgument&) {
VERIFY(true);
}
}