We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6069c44 commit d39c4eaCopy full SHA for d39c4ea
std/sumtype.d
@@ -2575,6 +2575,27 @@ version (D_Exceptions)
2575
}
2576
2577
2578
+// return ref
2579
+// issue: https://issues.dlang.org/show_bug.cgi?id=23101
2580
+@safe unittest
2581
+{
2582
+ static assert(!__traits(compiles, () {
2583
+ SumType!(int, string) st;
2584
+ return st.match!(
2585
+ function int* (string x) => assert(0),
2586
+ function int* (return ref int i) => &i,
2587
+ );
2588
+ }));
2589
+
2590
2591
+ static assert(__traits(compiles, () {
2592
2593
+ function int* (string x) => null,
2594
2595
2596
2597
+}
2598
2599
private void destroyIfOwner(T)(ref T value)
2600
{
2601
static if (hasElaborateDestructor!T)
0 commit comments