Skip to content

[BUG] _braced-init-list_ argument in Cpp2 #542

Open
@JohelEGP

Description

@JohelEGP

Title: braced-init-list argument in Cpp2.

Description:

#449 should be fixed by #487,
and here I extract a remaining issue:

point: type = {
    operator=: (out this, x: int, y: int) = {}
}
check: (p: point) = {}
main: () = {
    _ = (: point = (0, 0)) + (0, 0); // ERROR!
    check((0, 0)); // BUG!
}

AFAIK, you could always use parentheses to initialize a variable, and assign to one (modulo bugs).
ab29f19 added support for return.
I don't remember check((0, 0)); // BUG! ever being supported (or it was always bugged).
So the bug is either that it lowers

  • to a comma operator, rather than being rejected, or
  • to a parenthesized expression list, rather than braces for initialization.

-- #449 (comment) (extract)

I'm trying to convert the SFML's https://www.sfml-dev.org/documentation/2.6.0/#example:

    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

to Cpp2, which in its master branch (SFML 3) looks like:

    // Create the main window
    sf::RenderWindow window(sf::VideoMode({800, 600}), "SFML window");

Fortunately, I can name the type, so I translated it to:

  // Create the main window
  window: sf::RenderWindow = (:sf::VideoMode = :sf::Vector2u = (800, 600), "SFML window");

But what if this Cpp1's API type wasn't possible to be named,
and required such Cpp1 syntax to be used: sf::VideoMode({800, 600})?

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