diff --git a/include/stdx/ct_string.hpp b/include/stdx/ct_string.hpp index 59b599c..b457733 100644 --- a/include/stdx/ct_string.hpp +++ b/include/stdx/ct_string.hpp @@ -124,14 +124,18 @@ template CONSTEVAL auto operator""_cts() { return S; } } // namespace ct_string_literals } // namespace literals +struct ct_check_value {}; + template struct ct_check_t { template constexpr static bool diagnostic = false; template - constexpr static auto emit() -> void + constexpr static auto emit() -> ct_check_value requires diagnostic; }; template <> struct ct_check_t { - template constexpr static auto emit() -> void {} + template constexpr static auto emit() -> ct_check_value { + return {}; + } }; template constexpr auto ct_check = ct_check_t{}; diff --git a/test/fail/ct_check.cpp b/test/fail/ct_check.cpp index 5e70847..21f8909 100644 --- a/test/fail/ct_check.cpp +++ b/test/fail/ct_check.cpp @@ -6,6 +6,6 @@ constexpr auto msg = stdx::ct_string{"01234567890123456789012345678901234567890123456789"}; auto main() -> int { - stdx::ct_check.emit<"not emitted">(); + [[maybe_unused]] auto x = stdx::ct_check.emit<"not emitted">(); stdx::ct_check.emit(); }