Skip to content

[BUG] Cppfront reports incorrect errors when a multi-statement function has no enclosing braces #946

Closed
@bluetarpmedia

Description

@bluetarpmedia

Describe the bug
Cppfront reports an incorrect error when parsing an ill-formed multi-statement function missing its enclosing braces.

To Reproduce
Run cppfront on this ill-formed code:

func: () =
    message := "Hello world\n";
    std::cout << message;

Godbolt

Cppfront reports: error: local variable message is not used; consider changing its name to '_' to make it explicitly anonymous, or removing it entirely if its side effects are not needed

Another:

func: () =
    std::cout << "Hello ";
    std::cout << " world\n";

Godbolt

Cppfront reports: error: pure-cpp2 switch disables Cpp1 syntax

But in these cases I'd expect a syntax error indicating the block is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions