Skip to content

Commit 5c30222

Browse files
committed
Fix bug in C code generation: Still emit RHS of void types since there can be effects.
1 parent ef6a27f commit 5c30222

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/internal/CCodegen.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ trait CCodegen extends CLikeCodegen with CppHostTransfer {
4646
override def emitValDef(sym: Sym[Any], rhs: String): Unit = {
4747
if (!isVoidType(sym.tp))
4848
stream.println(remapWithRef(sym.tp) + quote(sym) + " = " + rhs + ";")
49+
else // we might still want the RHS for its effects
50+
stream.println(rhs + ";")
4951
}
5052

5153
override def emitVarDef(sym: Sym[Variable[Any]], rhs: String): Unit = {

0 commit comments

Comments
 (0)