www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1099] New: weird tupleof behavior in mixins

reply d-bugmail puremagic.com writes:
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);
}


-- 
Apr 05 2007
next sibling parent d-bugmail puremagic.com writes:
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


-- 
Apr 06 2007
prev sibling parent d-bugmail puremagic.com writes:
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.


-- 
Jun 28 2008