www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10373] New: cannot resolve forward reference (dmd2.063)

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

           Summary: cannot resolve forward reference (dmd2.063)
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: coz.d.lang gmail.com


--- Comment #0 from coz.d.lang gmail.com 2013-06-16 02:16:37 PDT ---
/**
 *    Main.d
 */

private import std.traits;

struct Test0(T, int N=0)
{
    static if (N == 0) { T[] mBuffer; }
    else { T[N]    mBuffer; }
    static if (is(T == class)){}
    else
    {
        T* at_(size_t n) { return &mBuffer[n]; }
        static if (is(typeof(*at_(0) = T.init)))
        { T opIndexAssign(T value, size_t index) { return (*at_(index) =
value); } }
    }
}
struct Test1(T, int N=0)
{
    static if (is(T == class)){}
    else
    {
        T* at_(size_t n) { return &mBuffer[n]; }
        static if (is(typeof(*at_(0) = T.init)))
        { T opIndexAssign(T value, size_t index) { return (*at_(index) =
value); } }
    }
    static if (N == 0) { T[] mBuffer; }
    else { T[N]    mBuffer; }
}

struct Test2(T, int N=0)
{
    static if (is(T == class)){}
    else
    {
        T* at_(size_t n) { return &mBuffer[n]; }
        static if (std.traits.isMutable!T)
        { T opIndexAssign(T value, size_t index) { return (*at_(index) =
value); } }
    }
    static if (N == 0) { T[] mBuffer; }
    else { T[N]    mBuffer; }
}

void main()
{
    static if (is(Test0!(int, 2))) pragma(msg, "Test0 is OK");
    else pragma(msg, "Test0 is NG");
    static if (is(Test1!(int, 2))) pragma(msg, "Test1 is OK");
    else pragma(msg, "Test1 is NG");
    static if (is(Test2!(int, 2))) pragma(msg, "Test2 is OK");
    else pragma(msg, "Test2 is NG");

    Test0!(int, 2) test0; // OK(dmd2.062)   OK (dmd2.063)
    Test1!(int, 2) test1; // OK(dmd2.062)   NG (dmd2.063)
    Test2!(int, 2) test2; // OK(dmd2.062)   OK (dmd2.063)

    /+ output dmd2.063
    Test0 is OK
    Main.d(24): Error: undefined identifier mBuffer
    Test1 is NG
    Test2 is OK
    Main.d(24): Error: undefined identifier mBuffer
    Main.d(49): Error: template instance Main.Test1!(int, 2) cannot resolve
forward reference
    Main.d(26): Error: this for at_ needs to be type Test1 not type Test1
    Main.d(55): Error: template instance Main.Test1!(int, 2) error
instantiating
    +/
}

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-06-17 17:18:07 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2192

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



--- Comment #2 from github-bugzilla puremagic.com 2013-06-23 19:35:56 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f527c4171e34f8e7a52b83addc787bfd5b73402d
fix Issue 10373 - cannot resolve forward reference

https://github.com/D-Programming-Language/dmd/commit/97810dedfc7c13b489be3920c8e5c97f9b90d164
Merge pull request #2192 from 9rnsr/fix10373

[REG2.063] Issue 10373 - cannot resolve forward reference

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



--- Comment #3 from github-bugzilla puremagic.com 2013-06-23 19:40:31 PDT ---
Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/65a72737658522e957745adc52aede6e56d003a7
Merge pull request #2192 from 9rnsr/fix10373

[REG2.063] Issue 10373 - cannot resolve forward reference

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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