D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6903 - Auto Return Doesn't Work With Nested Functions
Summary: Auto Return Doesn't Work With Nested Functions
Status: RESOLVED DUPLICATE of issue 4401
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-11-07 08:38 UTC by David Simcha
Modified: 2011-11-07 09:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011-11-07 08:38:26 UTC
This may technically be an enhancement request, but it seems like a massive, glaring inconsistency for no good reason, so I consider it a bug.

void main() {
    auto foo() {
        return 3;
    }
}

test.d(2): function declaration without return type. (Note that constructors are always named 'this')
test.d(2): no identifier for declarator foo()
Comment 1 bearophile_hugs 2011-11-07 09:34:33 UTC
See bug 4401
Comment 2 Kenji Hara 2011-11-07 09:54:21 UTC
This is parser problem, and there is no reason to reject it from dmd internally
(e.g. The return type of function literal is almost inferred).

*** This issue has been marked as a duplicate of issue 4401 ***