***************** 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
This is a regression. Introduced in https://github.com/D-Programming-Language/dmd/commit/a04cf864b932061ad7b72e7cad8b16fabc6a825a
(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
(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)
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
(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
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
Commits pushed to stable 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
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.
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