Skip to content

Commit 73a1983

Browse files
committed
Update test to handle true_type instead of bool
1 parent 994c073 commit 73a1983

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

regression-tests/mixed-type-safety-1.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Square : public Shape { };
1313
print: ( msg: std::string, x: _ ) =
1414
std::cout << msg << x << "\n";
1515

16-
print: ( msg: std::string, b: bool ) =
16+
print: <B:std::convertible_to<bool>> ( msg: std::string, copy b: B ) =
1717
{
1818
bmsg: * const char;
1919
if b { bmsg = "true"; }

regression-tests/test-results/mixed-type-safety-1.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Square : public Shape { };
2525
auto print(cpp2::in<std::string> msg, auto const& x) -> void;
2626

2727

28-
auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void;
28+
template<std::convertible_to<bool> B> auto print(cpp2::in<std::string> msg, B b) -> void;
2929

3030
#line 24 "mixed-type-safety-1.cpp2"
3131
//--- examples -------------------------
@@ -40,10 +40,10 @@ auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void;
4040
auto print(cpp2::in<std::string> msg, auto const& x) -> void {
4141
std::cout << msg << x << "\n"; }
4242

43-
auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void
43+
template<std::convertible_to<bool> B> auto print(cpp2::in<std::string> msg, B b) -> void
4444
{
4545
cpp2::deferred_init<char const*> bmsg;
46-
if (b) { bmsg.construct("true");}
46+
if (std::move(b)) {bmsg.construct("true");}
4747
else {bmsg.construct("false"); }
4848
std::cout << msg << std::move(bmsg.value()) << "\n";
4949
}

0 commit comments

Comments
 (0)