[Issue 1073] New: CTFE: mixin expression with a function argument doesn't work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 20 00:57:53 PDT 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 at digitalmars.com
ReportedBy: torhu at 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.
--
More information about the Digitalmars-d-bugs
mailing list