[Issue 12797] New: RDMD tries to compile imports inside traits(compiles,...)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 24 18:10:33 PDT 2014
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 at puremagic.com
Reporter: cbkbbejeap at mailinator.com
// test.d
enum x = __traits(compiles, (){ import doesNotExist; });
DMD works:
> dmd -c test.d
RDMD fails:
> rdmd -c test.d
Error: 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.
--
More information about the Digitalmars-d-bugs
mailing list