http://d.puremagic.com/issues/show_bug.cgi?id=10952



--- Comment #1 from Andrej Mitrovic <[email protected]> 2013-09-02 
10:09:41 PDT ---
Additionally I'm curious about the class situation:

class C
{
    this(int x = 1) { assert(0); }
}

According to the DMDFE, this is *not* a default ctor, and yet, it's the only
one generated in the assembly code. What exactly is the terminology for a
default constructor (with regards to defaulted parameters)?

It's also interesting that Object.factory returns null if you have any ctor,
even one with with a defaulted parameter:

-----
class C
{
    this(int x = 1) { }
}

import std.stdio;

void main()
{
    auto c = Object.factory("test.C");
    assert(c !is null);  // fails
}
-----

So we have the situation where:
auto s = S();  // works, but doesn't call the user ctor
auto c = new C();  // works AND calls the user ctor
Object.factory("test.C");  // works only if there's no user-ctor, even one with
default parameters

This is an inconsistent mess.

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

Reply via email to