PhobosWatch: manifest => enum

Steven Schveighoffer schveiguy at yahoo.com
Fri Dec 28 12:22:15 PST 2007


"Janice Caron" wrote
> On 12/28/07, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>> struct S { char[] str};
>>
>> const S x = S("hello".dup);
>> auto y = x;
>>
>> If y is not const, then y.str is not const, yet it points to the same 
>> data
>> as x.
>
> Yeah, you're right.
>
> But doesn't the same problem occur with
>
>    enum { S x = S("hello".dup); }
>    auto y = x;
>
> ?

Is that valid?  I didn't think dup could be a compile-time constant because 
it uses the heap...

-Steve 





More information about the Digitalmars-d mailing list