File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -124,14 +124,18 @@ template <ct_string S> CONSTEVAL auto operator""_cts() { return S; }
124124} // namespace ct_string_literals
125125} // namespace literals
126126
127+ struct ct_check_value {};
128+
127129template <bool B> struct ct_check_t {
128130 template <ct_string S> constexpr static bool diagnostic = false ;
129131 template <ct_string S>
130- constexpr static auto emit () -> void
132+ constexpr static auto emit () -> ct_check_value
131133 requires diagnostic<S>;
132134};
133135template <> struct ct_check_t <true > {
134- template <ct_string S> constexpr static auto emit () -> void {}
136+ template <ct_string S> constexpr static auto emit () -> ct_check_value {
137+ return {};
138+ }
135139};
136140template <bool B> constexpr auto ct_check = ct_check_t <B>{};
137141
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ constexpr auto msg =
66 stdx::ct_string{" 01234567890123456789012345678901234567890123456789" };
77
88auto main () -> int {
9- stdx::ct_check<true >.emit <" not emitted" >();
9+ [[maybe_unused]] auto x = stdx::ct_check<true >.emit <" not emitted" >();
1010 stdx::ct_check<false >.emit <msg>();
1111}
You can’t perform that action at this time.
0 commit comments