www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10736] New: Regression (2.064 git-head): Instantiation failure triggered by module import and module order

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10736

           Summary: Regression (2.064 git-head): Instantiation failure
                    triggered by module import and module order
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-07-31
13:16:15 PDT ---
Three files:

foo\all.d:
-----
module foo.all;

import foo.array;
import foo.range;
-----

foo\array.d:
-----
module foo.array;

import std.range;
-----

foo\range.d:
-----
module foo.range;

import std.range;

void main()
{
    int[] arr = [0, 1, 2, 3];
    auto x = chunks(arr, 4);  // error
}
-----

Compile (in this exact order):

$ dmd foo\all.d foo\array.d foo\range.d
 C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\range.d(6543): Error:
template std.range.chunks does not match any function template declaration. 
If you remove the import to `std.range` inside of `foo.array`, it will compile. $ dmd foo\all.d foo\array.d foo\range.d
 
If you instead change the compilation order so 'foo\range.d' is compiled first, then it will also compile: $ foo\range.d dmd foo\all.d foo\array.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10736


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-08-01 07:09:12 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2442

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10736



--- Comment #2 from github-bugzilla puremagic.com 2013-08-06 22:03:37 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f58e9b20ffb865b4256b4fed917d3e5afc1e914b
fix Issue 10736 - Regression (2.064 git-head): Instantiation failure triggered
by module import and module order

In the reduced test case, `test10736b` instantiates `chunks` template
function, then it instantiates `Chunks!(int[])`. The instance object will
be inserted to `test10736a` member because it is the first module that
importing `test10736c`. But in this time, `test10736a` module's semantic3
is already done, then `Chunks!(int[])` would immediately invoke its
semantic3, then `Chunks!(int[]).opSlice` refers *not yet instantiation
finished* `chunks` template.

To avoid the forward reference problem, we should defer semantic3 of
template instances which inserted to module scope.

https://github.com/D-Programming-Language/dmd/commit/314a1cca9ff56775b9e2a9cf81564135be0726b1
Merge pull request #2442 from 9rnsr/fix10736

[REG2.064a] fix Issue 10736 - Regression (2.064 git-head): Instantiation
failure triggered by module import and module order

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 06 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10736


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 06 2013