Skip to content

Commit 515d415

Browse files
committed
Fix a C++23 template specialization issue
1 parent ecd141d commit 515d415

File tree

8 files changed

+12
-303
lines changed

8 files changed

+12
-303
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ print: ( msg: std::string, b: bool ) =
2626

2727
main: () -> int =
2828
{
29-
print( "1.1 is int? ", 1.1 is int );
30-
print( "1 is int? ", 1 is int );
29+
::print( "1.1 is int? ", 1.1 is int );
30+
::print( "1 is int? ", 1 is int );
3131

3232
c := new<Circle>(); // safe by construction
3333
s : * Shape = c.get(); // safe by Lifetime
34-
print("\ns* is Shape? ", s* is Shape );
35-
print( "s* is Circle? ", s* is Circle );
36-
print( "s* is Square? ", s* is Square );
34+
::print("\ns* is Shape? ", s* is Shape );
35+
::print( "s* is Circle? ", s* is Circle );
36+
::print( "s* is Square? ", s* is Square );
3737
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ main: () -> int =
2323

2424
test_generic: ( x, msg ) = {
2525
msgx: std::string = msg;
26-
print( msgx + " is int? ", x is int );
26+
::print( msgx + " is int? ", x is int );
2727
}
2828

2929
print: ( msg: std::string, b: bool ) = {

regression-tests/test-results/clang-18-c++23-libcpp/mixed-type-safety-1.cpp.output

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

regression-tests/test-results/clang-18-c++23-libcpp/pure2-type-safety-1.cpp.output

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

regression-tests/test-results/gcc-14-c++2b/pure2-type-safety-1.cpp.output

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

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void
5858
#line 27 "mixed-type-safety-1.cpp2"
5959
[[nodiscard]] auto main() -> int
6060
{
61-
print("1.1 is int? ", cpp2::impl::is<int>(1.1));
62-
print( "1 is int? ", cpp2::impl::is<int>(1));
61+
::print("1.1 is int? ", cpp2::impl::is<int>(1.1));
62+
::print( "1 is int? ", cpp2::impl::is<int>(1));
6363

6464
auto c {cpp2_new<Circle>()}; // safe by construction
6565
Shape* s {CPP2_UFCS(get)(cpp2::move(c))}; // safe by Lifetime
66-
print("\ns* is Shape? ", cpp2::impl::is<Shape>(*cpp2::impl::assert_not_null(s)));
67-
print( "s* is Circle? ", cpp2::impl::is<Circle>(*cpp2::impl::assert_not_null(s)));
68-
print( "s* is Square? ", cpp2::impl::is<Square>(*cpp2::impl::assert_not_null(cpp2::move(s))));
66+
::print("\ns* is Shape? ", cpp2::impl::is<Shape>(*cpp2::impl::assert_not_null(s)));
67+
::print( "s* is Circle? ", cpp2::impl::is<Circle>(*cpp2::impl::assert_not_null(s)));
68+
::print( "s* is Square? ", cpp2::impl::is<Square>(*cpp2::impl::assert_not_null(cpp2::move(s))));
6969
}
7070

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
11
pure2-type-safety-1.cpp
2-
pure2-type-safety-1.cpp2(26): error C2666: 'print': overloaded functions have similar conversions
3-
pure2-type-safety-1.cpp2(29): note: could be 'void print(const std::string &,const bool)'
4-
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include\print(125): note: or 'void std::print<std::false_type>(const std::basic_format_string<char,std::integral_constant<bool,false>>,std::false_type &&)' [found using argument-dependent lookup]
5-
pure2-type-safety-1.cpp2(26): note: while trying to match the argument list '(std::basic_string<char,std::char_traits<char>,std::allocator<char>>, std::false_type)'
6-
pure2-type-safety-1.cpp2(26): note: the template instantiation context (the oldest one first) is
7-
pure2-type-safety-1.cpp2(8): note: see reference to function template instantiation 'void test_generic<double,char[7]>(const _T0 &,const _T1 (&))' being compiled
8-
with
9-
[
10-
_T0=double,
11-
_T1=char [7]
12-
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void;
5555
#line 24 "pure2-type-safety-1.cpp2"
5656
auto test_generic(auto const& x, auto const& msg) -> void{
5757
std::string msgx {msg};
58-
print(cpp2::move(msgx) + " is int? ", cpp2::impl::is<int>(x));
58+
::print(cpp2::move(msgx) + " is int? ", cpp2::impl::is<int>(x));
5959
}
6060

6161
#line 29 "pure2-type-safety-1.cpp2"

0 commit comments

Comments
 (0)