[Issue 1059] String literal concatenated with array of chars - inconsistent behavior

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 23 09:33:09 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1059





------- Comment #4 from matti.niemenmaa+dbugzilla at iki.fi  2008-08-23 11:33 -------
This one I haven't found a workaround for:

template Id(char[] s) { const Id = s; }

// succeed
static assert (Id!("x" ~ "y")     == "xy");
static assert (Id!(['x'] ~ ['y']) == "xy");

// fail
static assert (Id!("x" ~ ['y'])   == "xy");
static assert (Id!(['x'] ~ "y")   == "xy");

The second two give errors of the form:

asdf.d(7): Error: expression "x" ~ ['y'] is not a valid template value argument
asdf.d(7): template instance asdf.Id!("x" ~ ['y']) error instantiating
asdf.d(7): static assert  ("x" ~ ['y'] == "xy") is not evaluatable at compile
time


-- 



More information about the Digitalmars-d-bugs mailing list