digitalmars.D.bugs - [Issue 6578] New: Ignored const with struct with constructor
- d-bugmail puremagic.com (45/45) Aug 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6578
- d-bugmail puremagic.com (14/14) Jan 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6578
- d-bugmail puremagic.com (6/6) Mar 05 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6578
- d-bugmail puremagic.com (12/12) Mar 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6578
- d-bugmail puremagic.com (15/15) Mar 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6578
- d-bugmail puremagic.com (12/24) Apr 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6578
http://d.puremagic.com/issues/show_bug.cgi?id=6578 Summary: Ignored const with struct with constructor Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: accepts-invalid, diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc In DMD 2.055head this compiles and runs with no errors: struct Foo { int x; this(int x_) { this.x = x_; } } void main() { auto f1 = new const(Foo)(1); f1.x++; auto f2 = new immutable(Foo)(1); f2.x++; auto f3 = const(Foo)(1); f3.x++; auto f4 = immutable(Foo)(1); f4.x++; } While this generates two errors: struct Foo { int x; } void main() { auto f5 = const(Foo)(1); f5.x++; // error auto f6 = immutable(Foo)(1); f6.x++; // error } I think in the first program the f1,f2,f3,f4 structs too need to raise a compile-time error. Thanks to Timon Gehr for a suggestion. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6578 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|diagnostic |patch CC| |yebblies gmail.com Platform|x86 |All AssignedTo|nobody puremagic.com |yebblies gmail.com OS/Version|Windows |All The devil's patch: https://github.com/D-Programming-Language/dmd/pull/666 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6578 *** Issue 9647 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 05 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6578 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b133ffbad523c03c11a3253595fb4edf1ccc53b4 Issue 6578 - Wrong type deduction for NewExp and __ctor with struct Add the constructor's modifiers to the result type, instead of replacing them. https://github.com/D-Programming-Language/dmd/commit/a319e6d4c70de1fcc28a21b743d3367fb533e116 Issue 6578 - Wrong type deduction for NewExp and __ctor with struct -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 06 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6578 Yet another test case: struct S { this(int[] arr) immutable {} } void main() { auto s = S([1,2,3]); pragma(msg, typeof(s)); // prints immutable(S) } Can be fixed by: https://github.com/D-Programming-Language/dmd/pull/1726 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 06 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6578 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXEDYet another test case: struct S { this(int[] arr) immutable {} } void main() { auto s = S([1,2,3]); pragma(msg, typeof(s)); // prints immutable(S) } Can be fixed by: https://github.com/D-Programming-Language/dmd/pull/1726Pull-request 1726 is merged, and this issue has been fixed properly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 26 2013