digitalmars.D.bugs - [Issue 12797] New: RDMD tries to compile imports inside
- via Digitalmars-d-bugs (30/32) May 24 2014 https://issues.dlang.org/show_bug.cgi?id=12797
https://issues.dlang.org/show_bug.cgi?id=12797 Issue ID: 12797 Summary: RDMD tries to compile imports inside traits(compiles,...) Product: D Version: unspecified Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: tools Assignee: nobody puremagic.com Reporter: cbkbbejeap mailinator.com // test.d enum x = __traits(compiles, (){ import doesNotExist; }); DMD works:dmd -c test.dRDMD fails:rdmd -c test.dError: cannot read file doesNotExist.d The problem is RDMD gets dependencies by reading DMD's -v output, which always includes doesNotExist (since DMD *does* attempt to import it). Since RDMD sees doesNotExist in the -v output, it mistakenly tries to build it. This prevents optional imports from working with RDMD: static if( __traits(compiles, (){ import foobar; }) ) { import foobar; } else /+ do something else +/ It might be better for RDMD to read the -deps output instead, and omit the files listed with "(???)" as the filename. --
May 24 2014