Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grammar allows missing function body for AutoFuncDeclaration #4101

Open
dlangBugzillaToGithub opened this issue Jan 14, 2020 · 0 comments
Open

Comments

@dlangBugzillaToGithub
Copy link

Dennis (@dkorpel) reported this on 2020-01-14T21:08:37Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=20504

Description

This does not compile:
```
void foo()() {
    nothrow bar() {} // allowed
    nothrow bar(); // should parse according to spec
}
```
The spec says that in an AutoFuncDeclaration a MissingFunctionBody is allowed, yet even before instantiating template foo it raises an error:
Error: function declaration without return type.

I suggest only allowing SpecifiedFunctionBody in an AutoFuncDeclaration since it would always be a semantic error anyways (you can't infer the return type without a function body).

https://dlang.org/spec/grammar.html#AutoFuncDeclaration
https://dlang.org/spec/grammar.html#FunctionBody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant