March 20, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1073

           Summary: CTFE: mixin expression with a function argument doesn't
                    work
           Product: D
           Version: 1.009
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: torhu@yahoo.com


This code checks if TEST is defined, and defines it if not.  If using the line that's commented out instead of the one above it, it works as expected.

---
const int TEST = 1;

char[] def(char[] s) {
    if (!is(typeof(mixin(s))))  // doesn't detect that TEST is defined
    //if (!is(typeof(mixin("TEST"))))  // this works fine
        return "const int " ~ s ~ " = 3;\n";
    else return "";
}

mixin(def("TEST"));

void main() { }
---

test.d: variable test.TEST conflicts with test.TEST at test.d(1)


I tried to recreate this problem without CTFE, just with a static if, but it doesn't happen then.


-- 

March 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1073


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from bugzilla@digitalmars.com  2007-03-31 17:29 -------
What this code is trying to do is to dynamically change the parse, rather than the evaluated result, at compile time. This isn't going to work (should use templates for that). I'll put some clarifications in the spec about this.


--