Static strings in templates

Christopher Wright dhasenan at gmail.com
Fri May 2 05:18:52 PDT 2008


Janice Caron wrote:
<snip>
> However, the template can't be instantiated with
> 
>     int n = foo("abcde","fg");
> 
> because the type of the first argument is invariant(char)[5u], and the
> type of the second argument is invariant(char)[2u], and the compiler
> can't figure out that both can (and should) be implicitly cast to
> invariant(char)[].

I'd call it a compiler bug since static arrays are, as you say, 
implicitly convertible to dynamic ones.

Of course, you could just call it with:
int n = foo("abcde"[], "fg");



More information about the Digitalmars-d mailing list