Thread overview
[Issue 1113] New: Mixin causes incorrect static if branching
Apr 08, 2007
d-bugmail
Apr 27, 2007
d-bugmail
Sep 10, 2009
Don
April 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1113

           Summary: Mixin causes incorrect static if branching
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: reiner.pope@gmail.com


The following code fails:
template Foo()
{
   mixin("alias char[] TheType;");
   static if (is(TheType : char[]))
       static assert(true);
   else
       static assert(false);
}

alias Foo!() instance1;

mixins1.d(7): static assert  is false

The following similar programs all compile:
// 1. Replace the mixin with the statement itself
template Foo()
{
   alias char[] TheType;
   static if (is(TheType : char[]))
       static assert(true);
   else
       static assert(false);
}

alias Foo!() instance1;

// 2. Add a dummy declaration at the beginning of the template
template Foo()
{
   char[] dummy;
   mixin("alias char[] TheType;");
   static if (is(TheType : char[]))
       static assert(true);
   else
       static assert(false);
}

alias Foo!() instance1;

// 3. Replace static if with static assert
template Foo()
{
   mixin("alias char[] TheType;");
   static assert(is(TheType : char[]));
}

alias Foo!() instance1;


-- 

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


thomas-dloop@kuehne.cn changed:

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




------- Comment #1 from thomas-dloop@kuehne.cn  2007-04-27 12:33 -------
Adde to DStress as http://dstress.kuehne.cn/compile/m/mixin_35_A.d http://dstress.kuehne.cn/compile/m/mixin_35_B.d http://dstress.kuehne.cn/compile/m/mixin_35_C.d http://dstress.kuehne.cn/compile/m/mixin_35_D.d


-- 

September 10, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1113


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-10 14:15:31 PDT ---
This was fixed in DMD1.020 or earlier.

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