www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6937] New: new with struct doesn't allow field assignment

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6937

           Summary: new with struct doesn't allow field assignment
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



struct
{
  int a;
}

auto s1 = S(2); // works
auto s2 = new S(2); // doesn't work

----------

New with struct strictly requires a defined constructor while
it should have the same construction rules as a normal struct literal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6937




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4a22ca0053252454c5cddab2c5754b8a2f500544
fix Issue 6937 - new with struct doesn't allow field assignment

https://github.com/D-Programming-Language/dmd/commit/ee695eb92086cb73f62e7e01f019171776308435


Issue 6937 - new with struct doesn't allow field assignment

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6937


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



Despite this looks like a silent little change, this is a significant
improvement in D, and it's one of the best improvements for DMD 2.061. This
removes some useless code from my D2 code base.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6937





 Despite this looks like a silent little change, this is a significant
 improvement in D, and it's one of the best improvements for DMD 2.061. This
 removes some useless code from my D2 code base.
This is not yet allowed to remove some more boilerplate code (the "new"): struct Node(T) { T data; Node* left, right; } void main() { alias N = Node!int; auto t1 = new N(1, new N(2, new N(3))); // OK alias M = Node!int.__ctor; // Not OK auto t2 = M(1, M(2, M(3))); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6937





 This is not yet allowed to remove some more boilerplate code (the "new"):
 
 
 struct Node(T) {
     T data;
     Node* left, right;
 }
 void main() {
     alias N = Node!int;
     auto t1 = new N(1, new N(2, new N(3))); // OK
     alias M = Node!int.__ctor; // Not OK
     auto t2 = M(1, M(2, M(3)));
 }
This is completely unrelated to this issue. Ideally __ctor should not appear in user code, and language specification would never support it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 06 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6937


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2012