www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9941] New: Allows to return class objects and pointers to the structures, which were created with "new".

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

           Summary: Allows to return class objects and pointers to the
                    structures, which were created with "new".
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: wazar.leollone yahoo.com



13:36:09 PDT ---
Allows next code:

class Foo
{
  this(int a){f=a;}
  int f;
}

static foo = new Foo(42);

Foo constructor can be evaluated at compile-time and static object foo can be
placed in static memory.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 16 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9941


bearophile_hugs eml.cc changed:

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



This is currently allowed:


class Foo {
    int f;
    this(int a) { f = a; }
}
const foo = new Foo(42);
void main() {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9941




12:59:45 PDT ---

 This is currently allowed:
 
 
 class Foo {
     int f;
     this(int a) { f = a; }
 }
 const foo = new Foo(42);
 void main() {}
Yes:) I was asked to create an issue for this opportunity. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 21 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9941


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE
             Status|NEW                         |RESOLVED
                 CC|                            |code dawg.eu
         Resolution|                            |FIXED
            Summary|Allows to return class      |[CTFE] Allow to store
                   |objects and pointers to the |"newed" classes and structs
                   |structures, which were      |in the data segment
                   |created with "new".         |



https://github.com/D-Programming-Language/dmd/pull/1724
https://github.com/D-Programming-Language/dmd/commit/3f3da10cac83dd42600c56f4d4434751bfa574cf

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 17 2013