Skip to content

Commit 62dfdcb

Browse files
committed
Allow -> _ deduced return type for operator<=>, closes #571
This example now works: ``` quantity: @struct <Number: type> type = { number: Number; operator<=>: (this, that) -> _; } main: () = quantity<float>() < quantity<float>(); ```
1 parent d2a6cd7 commit 62dfdcb

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

regression-tests/test-results/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cppfront compiler v0.2.1 Build 8812:1231
2+
cppfront compiler v0.2.1 Build 8812:1658
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8812:1231"
1+
"8812:1658"

source/sema.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,9 @@ class sema
13921392
if (n.has_name("operator<=>")) {
13931393
auto return_name = n.unnamed_return_type_to_string();
13941394
if (
1395-
return_name.find("strong_ordering") == return_name.npos
1396-
&& return_name.find("weak_ordering") == return_name.npos
1395+
return_name != "_"
1396+
&& return_name.find("strong_ordering" ) == return_name.npos
1397+
&& return_name.find("weak_ordering" ) == return_name.npos
13971398
&& return_name.find("partial_ordering") == return_name.npos
13981399
)
13991400
{

0 commit comments

Comments
 (0)