http://d.puremagic.com/issues/show_bug.cgi?id=5830
Summary: Bug in alias resolution for template value parameters
in is()?
Product: D
Version: D2
Platform: Other
OS/Version: Mac OS X
Status: NEW
Keywords: rejects-valid
Severity: critical
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from klickverbot <[email protected]> 2011-04-10 14:19:59 PDT
---
With current DMD 2 (0219a5f), the following snippet does not compile:
---
template isBar(T) {
static if (is(T _ : Bar!(v), string v)) {
enum isBar = true;
} else {
enum isBar = false;
}
}
struct Bar(string v) {}
pragma(msg, isBar!(Bar!("bar")));
---
The error message is: �Error: undefined identifier string�.
However, if �string� is replaced with �immutable(char)[]� in the is expression,
it gives the intended result:
---
template isBar(T) {
static if (is(T _ : Bar!(v), immutable(char)[] v)) {
enum isBar = true;
} else {
enum isBar = false;
}
}
struct Bar(string v) {}
pragma(msg, isBar!(Bar!("bar"))); // prints true
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------