Closed
Description
Describe the bug
A return
statement inside the one-line style function definition, generates bad code.
To Reproduce
This is the sample CPP2 code:
#include <iostream>
func1 :() = std::cout << "HI" << "\n";
func2 :() = return;
I've used Compiler Explorer.
It should generate the following C++ code:
auto func1() -> void { std::cout << "HI" << "\n"; }
auto func2() -> void { return; }
But it generates the following C++ code:
auto func1() -> void { std::cout << "HI" << "\n"; }
auto func2() -> voidreturn ;
Additional context
The transpiler is combined the return type void
and the statement return
of func2
, becuase it missed block symbols {}
in the generated code.