Bug? tupleof and const string = ""
Tobias Pankrath
tobias at pankrath.net
Thu Feb 13 08:42:26 PST 2014
On Thursday, 13 February 2014 at 16:37:20 UTC, Andre wrote:
> Hi,
>
> could you have a look whether this is a bug with tupleof?
> In case you have a const string with a default value,
> the attribute is not in the tupleof list.
>
> struct A {
> const string a = "abc";
> string d;
> }
>
> void main(){
> assert(A().tupleof.length == 2); // fails -> length = 1
> }
>
> Kind regards
> André
I'm not sure. May guess is the compiler figures that you'll never
be able to change a and pulls it out of the struct. What I don't
know is, if it should do this without using immutable or enum.
Besides: I don't think that const elements make any sense. What
do you want to do?
More information about the Digitalmars-d-learn
mailing list