January 14, 2020 [Issue 20504] New: grammar allows missing function body for AutoFuncDeclaration | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: dkorpel@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 -- |
Copyright © 1999-2021 by the D Language Foundation