www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1113] New: Mixin causes incorrect static if branching

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


-- 
Apr 08 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1113


thomas-dloop kuehne.cn changed:

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





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


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



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: -------
Sep 10 2009