File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 37
37
#include " ir/irmodule.h"
38
38
#include " llvm/IR/CFG.h"
39
39
#include " llvm/IR/InlineAsm.h"
40
+ #include " llvm/Support/Casting.h"
40
41
#include < fstream>
41
42
#include < math.h>
42
43
#include < stdio.h>
@@ -307,6 +308,11 @@ class ToIRVisitor : public Visitor {
307
308
irs->DBuilder .EmitStopPoint (fd->endloc );
308
309
}
309
310
311
+ if (returnValue->getType () != funcType->getReturnType ()) {
312
+ assert (llvm::cast<llvm::AllocaInst>(returnValue)->getAllocatedType () == funcType->getReturnType ());
313
+ returnValue = DtoLoad (funcType->getReturnType (), returnValue);
314
+ }
315
+
310
316
irs->ir ->CreateRet (
311
317
useRetValSlot ? DtoLoad (funcType->getReturnType (), funcGen.retValSlot )
312
318
: returnValue);
Original file line number Diff line number Diff line change
1
+ // RUN: %ldc %s -c
2
+
3
+ struct Test
4
+ {
5
+ this (ref inout typeof (this ) rhs) inout pure {}
6
+ const (char )[] toString () const pure => null ;
7
+ alias toString this ;
8
+ }
9
+
10
+ const (char )[] test (ref Test t)
11
+ {
12
+ return t;
13
+ }
You can’t perform that action at this time.
0 commit comments