Skip to content

[BUG] Can't mix requires clause with simple function body #423

Closed

Description

@JohelEGP

Title: Can't mix requires clause with simple function body.

Minimal reproducer (https://cpp2.godbolt.org/z/o6fcxPP9r):

f: () requires a = g();
main: () = { }

Commands:

cppfront -clean-cpp1 main.cpp2

Expected result:

a to be the requires's expression,
= g() to be f's initializer.

Actual result and error:

main.cpp2(1,1): error: a function must have a body ('=' initializer), unless it is virtual (has a 'virtual this' parameter) or is defaultable (operator== or operator<=>)

Suggested resolution:

 //G requires-clause:
-//G     'requires' expression
+//G     'requires' logical-or-expression

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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