Re: Struct reference returning function and const members

2011-03-03 Thread Michel Fortin
On 2011-03-03 01:42:18 -0500, Tom said: I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } I think the compiler complains because the s1.c member is not assignable (since it is const), so you can't

Re: Struct reference returning function and const members

2011-03-02 Thread Jonathan M Davis
On Wednesday 02 March 2011 22:42:18 Tom wrote: > I have... > > int main(string[] args) { > auto s1 = f(); // MH MH > auto s2 = g(); // OK > s2.c = null; // OK > return 0; > } > > class C {} > > struct StructWithConstMember { > this(int i, C c) { this.i=i; this.c=c;

Re: Struct reference returning function and const members

2011-03-02 Thread Tom
El 03/03/2011 03:47, Ali Çehreli escribió: On 03/02/2011 10:42 PM, Tom wrote: I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } class C {} struct StructWithConstMember { this(int i, C c) { this.i=i; this.c=c; } int i; const(C) c; }

Re: Struct reference returning function and const members

2011-03-02 Thread Ali Çehreli
On 03/02/2011 10:42 PM, Tom wrote: I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } class C {} struct StructWithConstMember { this(int i, C c) { this.i=i; this.c=c; } int i; const(C) c; } struct StructWithoutConstMember { this(int

Struct reference returning function and const members

2011-03-02 Thread Tom
I have... int main(string[] args) { auto s1 = f(); // MH MH auto s2 = g(); // OK s2.c = null; // OK return 0; } class C {} struct StructWithConstMember { this(int i, C c) { this.i=i; this.c=c; } int i; const(C) c; } struct StructWithoutCo