[Issue 10138] Regression (2.063 git-head): Using ReturnType with scoped no longer works

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 27 06:14:00 PDT 2013


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


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

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


--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2013-05-27 06:13:54 PDT ---
The code had a hidden bug with 2.062 dmd and earlier.

If class A has two ctors - one is default, another has arguments, and
initialize scoped value in B's ctor by calling argument version ctor, it had
caused errors.

import std.traits;
import std.typecons;

class A
{
    this() {}
    this(int) {}
}

class B
{
    ReturnType!(scoped!A) a;  // L12

    this()
    {
        a = scoped!A(1);    // L16
    }
}

void main()
{
}

Errors with 2.062:
test.d(16): Error: function
std.typecons.scoped!(A).scoped.Scoped!(A).Scoped.opAssign (Scoped!(A) p) is not
callable using argument types (Scoped!(A))
test.d(16): Error: cannot implicitly convert expression (scoped(1)) of type
Scoped!(A) to Scoped!(A)

In fact, the type you had extract by using ReturnType!(scoped!A) had not been
correct scoped value type. The bug has fixed by phobos/pull/1215, therefore the
OP code is invalid right now.

In conclusion, this is not a regression.

-- 
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