Skip to content

[BUG] short function body syntax generates bad code for named functions #257

Closed
@filipsajdak

Description

@filipsajdak

The current implementation of the cppfront compiles the following code:

f    :(x) = x + 2;
l := :(x) = x + 2;

to

auto f(auto const& x) -> void { x + 2; } // notice missing return
auto l {[](auto const& x) { return x + 2; }}; 

Expectation

I expect that the named and unnamed function defined with short function body syntax generates the same code that uses implicit return.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions