[Issue 5830] New: Bug in alias resolution for template value parameters in is()?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 10 14:23:43 PDT 2011
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: nobody at puremagic.com
ReportedBy: code at klickverbot.at
--- Comment #0 from klickverbot <code at klickverbot.at> 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: -------
More information about the Digitalmars-d-bugs
mailing list