[Issue 20504] New: grammar allows missing function body for AutoFuncDeclaration
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 14 21:08:37 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20504
Issue ID: 20504
Summary: grammar allows missing function body for
AutoFuncDeclaration
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P1
Component: dlang.org
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
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
--
More information about the Digitalmars-d-bugs
mailing list