Skip to content

Commit de2c399

Browse files
committed
Work around requires support issue in GCC 10
1 parent 515d415 commit de2c399

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ class Square : public Shape { };
1010

1111
//--- printing helpers -----------------
1212

13-
print: <T : type> ( msg: std::string, x: T )
14-
requires !std::convertible_to<T, bool> =
13+
non_bool: <T> concept = !std::convertible_to<T, bool>;
14+
15+
print: <T : non_bool> ( msg: std::string, x: T ) =
1516
std::cout << msg << x << "\n";
1617

1718
print: ( msg: std::string, b: bool ) =

regression-tests/test-results/gcc-10-c++20/mixed-type-safety-1.cpp.output

Lines changed: 0 additions & 5 deletions
This file was deleted.

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ class Square : public Shape { };
2424
//--- printing helpers -----------------
2525

2626
#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>);
2928

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"
3132
auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void;
3233

33-
#line 25 "mixed-type-safety-1.cpp2"
34+
#line 26 "mixed-type-safety-1.cpp2"
3435
//--- examples -------------------------
3536

3637
[[nodiscard]] auto main() -> int;
@@ -39,14 +40,11 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void;
3940

4041
#line 1 "mixed-type-safety-1.cpp2"
4142

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-
4643
#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 {
4745
std::cout << msg << x << "\n"; }
4846

49-
#line 17 "mixed-type-safety-1.cpp2"
47+
#line 18 "mixed-type-safety-1.cpp2"
5048
auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void
5149
{
5250
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
5553
std::cout << msg << cpp2::move(bmsg.value()) << "\n";
5654
}
5755

58-
#line 27 "mixed-type-safety-1.cpp2"
56+
#line 28 "mixed-type-safety-1.cpp2"
5957
[[nodiscard]] auto main() -> int
6058
{
6159
::print("1.1 is int? ", cpp2::impl::is<int>(1.1));

0 commit comments

Comments
 (0)