D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6430 - Overloaded auto-return functions each with a nested aggregate of the same name are conflated
Summary: Overloaded auto-return functions each with a nested aggregate of the same nam...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-08-02 13:34 UTC by kennytm
Modified: 2014-06-08 02:42 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 kennytm 2011-08-02 13:34:53 UTC
Test case 1:

-----------------------------
auto bug6430(int a) {
    static struct Result2 {}
    return 4;
}
auto bug6430(int a, int b) {
    static struct Result2 {
        int z;
        int y() { return z; }   // <-- line 11
    }
    auto t = Result2(1);   // <-- line 13
    return 5;
}
-----------------------------
x.d(11): Error: this for z needs to be type Result2 not type Result2
x.d(13): Error: more initializers than fields of Result2
-----------------------------

The same happens if we replace 'static struct' as 'class' or 'union' with or without 'static'.
Comment 1 SomeDude 2012-04-27 07:42:11 UTC
Also seen on 2.059 Win32
Comment 2 Kenji Hara 2014-05-17 14:29:09 UTC
Fixed in 2.062.
Comment 3 github-bugzilla 2014-06-08 02:42:26 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/470def4e3573e16b0869a083820488457bee86c8
fix Issue 6430 - Overloaded auto-return functions each with a nested aggregate of the same name are conflated