Fix UDL definitions for C++23

Technically, the declaration should not have a space between
the quotes and the underscore, because `_foo` is a reserved
identifier, but `""_foo` is not. In general it works, but newer
Clang versions warn about this, because WG21 wants to deprecate
and later remove this form completely.
This commit is contained in:
Martin Hořeňovský 2023-10-28 21:34:53 +02:00
parent 966d361551
commit 6ebc013b8c
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 3 additions and 3 deletions

View File

@ -70,10 +70,10 @@ namespace Catch {
}
namespace literals {
Approx operator "" _a(long double val) {
Approx operator ""_a(long double val) {
return Approx(val);
}
Approx operator "" _a(unsigned long long val) {
Approx operator ""_a(unsigned long long val) {
return Approx(val);
}
} // end namespace literals

View File

@ -177,7 +177,7 @@ TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") {
STATIC_REQUIRE_FALSE(sr1.empty());
STATIC_REQUIRE(sr1.size() == 3);
using Catch::operator"" _sr;
using Catch::operator""_sr;
constexpr auto sr2 = ""_sr;
STATIC_REQUIRE(sr2.empty());
STATIC_REQUIRE(sr2.size() == 0);