Bug 20504 – grammar allows missing function body for AutoFuncDeclaration

Status
NEW
Severity
normal
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-01-14T21:08:37Z
Last change time
2024-12-15T15:25:39Z
Keywords
spec
Assigned to
No Owner
Creator
Dennis
See also
https://issues.dlang.org/show_bug.cgi?id=5803
Moved to GitHub: dlang.org#4101 →

Comments

Comment #0 by dkorpel — 2020-01-14T21:08:37Z
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
Comment #1 by robert.schadek — 2024-12-15T15:25:39Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/4101 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB