@@ -349,10 +349,13 @@ trait CGenFunctions extends CGenEffect with BaseGenFunctions {
349
349
// Case for functions with a single argument (therefore, not tupled)
350
350
override def emitNode (sym : Sym [Any ], rhs : Def [Any ]) = rhs match {
351
351
case e@ Lambda (fun, x, y) =>
352
- stream.println(" auto " + quote(sym)+ " = [&](" + remap(x.tp)+ " " + quote(x)+ " ) {" )
352
+ val retType = remap(getBlockResult(y).tp)
353
+ stream.println(" function<" + retType+ " (" +
354
+ remap(x.tp)+ " )> " + quote(sym)+
355
+ " = [&](" + remap(x.tp)+ " " + quote(x)+ " ) {" )
353
356
emitBlock(y)
354
357
val z = getBlockResult(y)
355
- if (remap(z.tp) != " void" )
358
+ if (retType != " void" )
356
359
stream.println(" return " + quote(z) + " ;" )
357
360
stream.println(" };" )
358
361
case Apply (fun, arg) =>
@@ -374,10 +377,13 @@ trait CGenTupledFunctions extends CGenFunctions with GenericGenUnboxedTupleAcces
374
377
375
378
override def emitNode (sym : Sym [Any ], rhs : Def [Any ]) = rhs match {
376
379
case Lambda (fun, UnboxedTuple (xs), y) =>
377
- stream.println(" auto " + quote(sym)+ " = [&](" + xs.map(s=> remap(s.tp)+ " " + quote(s)).mkString(" ," )+ " ) {" )
380
+ val retType = remap(getBlockResult(y).tp)
381
+ stream.println(" function<" + retType+ " (" +
382
+ xs.map(s=> remap(s.tp)).mkString(" ," )+ " )> " + quote(sym)+
383
+ " = [&](" + xs.map(s=> remap(s.tp)+ " " + quote(s)).mkString(" ," )+ " ) {" )
378
384
emitBlock(y)
379
385
val z = getBlockResult(y)
380
- if (remap(z.tp) != " void" )
386
+ if (retType != " void" )
381
387
stream.println(" return " + quote(z) + " ;" )
382
388
stream.println(" };" )
383
389
case Apply (fun, UnboxedTuple (args)) =>
0 commit comments