@@ -24,13 +24,14 @@ class Square : public Shape { };
24
24
// --- printing helpers -----------------
25
25
26
26
#line 13 "mixed-type-safety-1.cpp2"
27
- template <typename T> auto print (cpp2::impl::in<std::string> msg, T const & x) -> void
28
- CPP2_REQUIRES (!(std::convertible_to<T,bool >)) ;
27
+ template <typename T> concept non_bool = !(std::convertible_to<T,bool >);
29
28
30
- #line 17 "mixed-type-safety-1.cpp2"
29
+ template <non_bool T> auto print (cpp2::impl::in<std::string> msg, cpp2::impl::in<T> x) -> void;
30
+
31
+ #line 18 "mixed-type-safety-1.cpp2"
31
32
auto print (cpp2::impl::in<std::string> msg, cpp2::impl::in<bool > b) -> void;
32
33
33
- #line 25 "mixed-type-safety-1.cpp2"
34
+ #line 26 "mixed-type-safety-1.cpp2"
34
35
// --- examples -------------------------
35
36
36
37
[[nodiscard]] auto main () -> int;
@@ -39,14 +40,11 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void;
39
40
40
41
#line 1 "mixed-type-safety-1.cpp2"
41
42
42
- #line 13 "mixed-type-safety-1.cpp2"
43
- template <typename T> auto print (cpp2::impl::in<std::string> msg, T const & x) -> void
44
- requires (!(std::convertible_to<T,bool >)) {
45
-
46
43
#line 15 "mixed-type-safety-1.cpp2"
44
+ template <non_bool T> auto print (cpp2::impl::in<std::string> msg, cpp2::impl::in<T> x) -> void {
47
45
std::cout << msg << x << " \n " ; }
48
46
49
- #line 17 "mixed-type-safety-1.cpp2"
47
+ #line 18 "mixed-type-safety-1.cpp2"
50
48
auto print (cpp2::impl::in<std::string> msg, cpp2::impl::in<bool > b) -> void
51
49
{
52
50
cpp2::impl::deferred_init<char const *> bmsg;
@@ -55,7 +53,7 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void
55
53
std::cout << msg << cpp2::move (bmsg.value ()) << " \n " ;
56
54
}
57
55
58
- #line 27 "mixed-type-safety-1.cpp2"
56
+ #line 28 "mixed-type-safety-1.cpp2"
59
57
[[nodiscard]] auto main () -> int
60
58
{
61
59
::print (" 1.1 is int? " , cpp2::impl::is<int >(1.1 ));
0 commit comments