digitalmars.D.bugs - [Issue 9008] New: Another forward referencing bug
- d-bugmail puremagic.com (72/72) Nov 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (8/8) Nov 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (8/8) Nov 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (10/10) Nov 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (8/8) Nov 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (12/12) Nov 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (8/8) Nov 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (10/10) Jan 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9008
- d-bugmail puremagic.com (8/9) Jan 13 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9008
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Summary: Another forward referencing bug Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: turkeyman gmail.com Rather complex situation, I couldn't boil it down anymore... Note the 2 commented lines; uncommenting these lines will make it work properly (this is my work-around) For some reason, scanning over each of the overloads in advance stops the forward reference error. This is tested using DMD-Win64. template TestHasAttribute( alias symbol, Attribute ) { template Impl( A... ) { static if( A.length == 0 ) enum bool Impl = false; else static if( is( typeof( A[0] ) == Attribute ) ) enum bool Impl = true; else enum bool Impl = Impl!( A[1..$] ); } alias Impl!( __traits( getAttributes, symbol ) ) TestHasAttribute; } string generateImportStubs( alias reference )() { string text; foreach( m; __traits( allMembers, reference ) ) { // scan for functions... static if( is( typeof( mixin( m ) ) ) && is( typeof( mixin( m ) ) == function ) ) { // uncomment these lines, and the bug disappears // foreach( i, overload; __traits( getOverloads, reference, m ) ) // enum nothing = typeof(overload).stringof; foreach( i, overload; __traits( getOverloads, reference, m ) ) { static if( TestHasAttribute!( overload, int ) ) text ~= ""; // mixin some stuff, irrelevant to the bug... } } } return text; } import std.traits; mixin( "alias " ~ moduleName!generateImportStubs ~ " TestThisModule;" ); mixin( generateImportStubs!( TestThisModule )() ); private: // overloads cause errors void overload(); void overload( int x ); test.d(124): Error: template instance remedy.test.TestHasAttribute!(overload, int) forward reference of overload test.d(124): Error: template instance remedy.test.TestHasAttribute!(overload, int) error instantiating test.d(135): instantiated from here: generateImportStubs!(test) test.d(135): called from here: generateImportStubs() test.d(135): Error: argument to mixin must be a string, not (generateImportStubs()) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ce0d593659ec80ce5a6e626bc9d663660dd74451 fix Issue 9008 - Another forward referencing bug -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1a2efd2a555604dfb6d19adf3899efa5dff49011 fix Issue 9008 - Another forward referencing bug -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 23:39:45 PST --- Ignore these "fixes", they were for bug 7220. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/cc91b4baa0761a8c4e1ba4fd7513a30f8bc9a3fe fix Issue 9008 - Another forward referencing bug -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Just tried it out, this fix silences the forward reference error message, but the situation is replaced by a new problem... The foreach over getOverloads only iterates once for the first overload in the series. Uncommenting the same lines that made the problem go away before causes all overloads to be iterated as expected. It's basically the same problem, just manifesting differently. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/64a2aa2a901633ac246a391a0a6ec46b2db2a096 supplemental fix for issue 9008 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9008 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Is this fixed now? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 12 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9008Is this fixed now?Try my code from the top. If it compiles without error, then yes. Sorry, I'm not near any computers for a few weeks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 13 2013