Bug 14666 – [REG2.061] Bogus forward reference error

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-06-09T00:12:00Z
Last change time
2016-10-01T11:45:42Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
deadalnix

Comments

Comment #0 by deadalnix — 2015-06-09T00:12:45Z
***************** module d.base.location; struct Location { import d.base.name; } ***************** auto getNames() { import d.lexer; } enum Names = getNames; ***************** module d.lexer; import d.base.location; struct Token { Location location; } ***************** I get libd/src/d/lexer.d(5): Error: struct d.lexer.Token has forward references when compiling d/base/location.d
Comment #1 by dlang-bugzilla — 2015-06-10T02:04:58Z
Comment #2 by k.hara.pg — 2015-06-10T02:53:28Z
(In reply to Vladimir Panteleev from comment #1) > This is a regression. > > Introduced in > https://github.com/D-Programming-Language/dmd/commit/ > a04cf864b932061ad7b72e7cad8b16fabc6a825a Could you please tell me how did you check that? I cannot reproduce the issue because the provided code lacks: - file name of each modules - directory tree - command line
Comment #3 by dlang-bugzilla — 2015-06-10T04:45:11Z
(In reply to Kenji Hara from comment #2) > Could you please tell me how did you check that? I cannot reproduce the > issue because the provided code lacks: > - file name of each modules > - directory tree > - command line I used my psychic powers :) https://github.com/CyberShadow/DBugTests/tree/master/14666 (Command is "dmd -o- location.d" as per bisect.ini)
Comment #4 by deadalnix — 2015-06-10T05:35:01Z
Sorry for the missing filenames, here they are: ****** d/base/location.d *********** module d.base.location; struct Location { import d.base.name; } ****** d/base/name.d *********** auto getNames() { import d.lexer; } enum Names = getNames; ****** d.lexer.d *********** module d.lexer; import d.base.location; struct Token { Location location; } ***************** $ dmd -c d/base/location.d
Comment #5 by k.hara.pg — 2015-06-10T12:20:53Z
(In reply to deadalnix from comment #4) > Sorry for the missing filenames, here they are: [snip] Thanks! https://github.com/D-Programming-Language/dmd/pull/4735
Comment #6 by github-bugzilla — 2015-06-10T17:35:19Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0504d664beacd11ec5d0e8afaf209357f2d0f9de fix Issue 14666 - Bogus forward reference error https://github.com/D-Programming-Language/dmd/commit/640c0e189eeb04daea64257d7de1e4acd2df562e Merge pull request #4735 from 9rnsr/fix14666 [REG2.061] Issue 14666 - Bogus forward reference error
Comment #7 by github-bugzilla — 2015-06-17T21:05:53Z
Comment #8 by github-bugzilla — 2016-03-31T07:05:44Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/711944c56bf50a7e7323cd34008311345e53f57c Add deferred semantic2 mechanism, and run semantic2 for all imported modules When a module is only imported from function local scopes, it couldn't get a change to run semantic2 analysis. It was "fix" for the issue 14666 case, but the deferred instance size finalization collides with that. Now, function local imports can cause module level mutual forward references. Their resolutions can be deferred until the global level analysis loop in `mars.d` at maximum, and all function local imports will work as same as module level ones.
Comment #9 by github-bugzilla — 2016-10-01T11:45:42Z
Commit pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/711944c56bf50a7e7323cd34008311345e53f57c Add deferred semantic2 mechanism, and run semantic2 for all imported modules