www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4678] New: Built struct is callable without opCall

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

           Summary: Built struct is callable without opCall
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-08-19 06:19:14 PDT ---
This D1 program compiles and runs with DMD 2.048:


import std.c.stdio: puts;
struct Foo {
    this(int) { puts("THIS"); }
}
void main() {
    auto bar = Foo(10);
    bar(20);
}


The output:
THIS
THIS


So the Foo constructor is run two times. I think this is not correct.

Foo lacks an opCall, so what I expect is a compile-time error that says that
'bar' is not callable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 19 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4678



--- Comment #1 from bearophile_hugs eml.cc 2011-06-26 01:00:13 PDT ---
I think there is a pull request with a patch for this bug, do you know what
one?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 26 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4678


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

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


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2012-05-30 19:39:34 PDT ---
*** This issue has been marked as a duplicate of issue 6036 ***

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