A tuple bug?
Max Samukha
samukha at voliacable.com
Tue Apr 24 03:05:57 PDT 2007
On Mon, 23 Apr 2007 23:42:37 +0300, Jari-Matti Makela
<jmjmak at utu.fi.invalid> wrote:
>Max Samukha wrote:
>> The output when compiling the code below is "1, 1" while it should be
>> "1, 2". When 'names' declarations are commented out, the output is
>> correct.
>
><snip>
>
>> Is it a bug?
>
>Yeah, something fishy is happening here (tested with dmd 1.013). This code
>
> template Foo(A...)
> {
> const char[] values = A[1].stringof;
>
> pragma(msg, A.length.stringof); // 1)
> pragma(msg, values);
> }
>
> void main()
> {
> alias Foo!(1,1,1,1,1) val;
> }
>
>returns
> 5
> 5
>
>but commenting the line 1) makes it return '1'. Also the compiler should
>be able to infer the type of 'values' when 'char[]' is omitted, but it
>doesn't. So, at least two bugs here.
Thanks. I've posted this to bugzilla
More information about the Digitalmars-d-learn
mailing list