[Issue 4678] New: Built struct is callable without opCall

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 19 06:19:19 PDT 2010


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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list