Thread overview
[Issue 1099] New: weird tupleof behavior in mixins
Apr 06, 2007
d-bugmail
Apr 06, 2007
d-bugmail
Jun 28, 2008
d-bugmail
May 14, 2012
Walter Bright
April 06, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1099

           Summary: weird tupleof behavior in mixins
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: h3r3tic@mat.uni.torun.pl


the following module should not compile, but it does. Tested with dmd 0.175, 1.010 and 1.010b.



template Mix(int a) {
        alias typeof(*this) ThisType;
        static assert (ThisType.init.tupleof.length == a);
}


struct Foo {
        mixin Mix!(0);
        int foo;
        mixin Mix!(1);
        int bar;
        mixin Mix!(2);
}


-- 

April 06, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1099


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All




------- Comment #1 from thomas-dloop@kuehne.cn  2007-04-06 04:14 -------
Added to DStress as http://dstress.kuehne.cn/nocompile/t/tupelof_01_A.d http://dstress.kuehne.cn/nocompile/t/tupelof_01_B.d


-- 

June 28, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1099





------- Comment #2 from h3r3tic@mat.uni.torun.pl  2008-06-28 06:30 -------
Perhaps D is designed to work this way? Mixin template instances also don't see fields declared after their mixing-in point, so it's kind of consistent... But pretty weird/confusing anyway.


-- 

May 14, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1099



--- Comment #3 from github-bugzilla@puremagic.com 2012-05-14 16:20:14 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9024f3680dc69edc20268cbcd7277016d165641d Fix issue 1099 weird tupleof behavior in mixins

Fixed some time ago, this is just the test case

https://github.com/D-Programming-Language/dmd/commit/85c54827db14f5a547015ab4a19fdd677f5449aa Merge pull request #949 from donc/bug1099testcaseonly

Fix issue 1099 weird tupleof behavior in mixins

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1099


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: -------