[Issue 9984] New: inout qualifier is skipped for constructor arguments (template constructor only)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 23 09:21:58 PDT 2013


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

           Summary: inout qualifier is skipped for constructor arguments
                    (template constructor only)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: maximzms at gmail.com


--- Comment #0 from Maksim Zholudev <maximzms at gmail.com> 2013-04-23 09:21:55 PDT ---
The following code does not compile:
--------------------
struct Foo
{
    int[] p;

    inout this()(inout int[] a) // test.d(5)
    {
        p = a;
    }

    auto foo() inout
    {
        return inout(Foo)(p); // test.d(12)
    }
}

void main() {}
--------------------
test.d(12): Error: template test.Foo.__ctor does not match any function
template declaration. Candidates are:
test.d(5):        test.Foo.__ctor()(int[] a)
test.d(12): Error: template test.Foo.__ctor()(int[] a) cannot deduce template
function from argument types !()(inout(int[])) inout
--------------------

There is no error if constructor is function not template

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