www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6208] New: Parameter storage classes are ignored in template function deducing.

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

           Summary: Parameter storage classes are ignored in template
                    function deducing.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



In the following code, ref storage class of function foo's parameter s is
ignored.
So calling foo with lvalue makes confusing.
----
int foo(S)(ref S s){ return 1; }
int foo(S)(S s){ return 2; }
void main()
{
    int n;
    assert(foo(n) == 1);  // Line 6
    assert(foo(0) == 2);
}
----
test.d(6): Error: template test.foo(S) foo(S) matches more than one template
declaration, test.d(1):foo(S) and test.d(2):foo(S)
----

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




P.S. Same problem exists with out and lazy.

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




I found related issue.

Type storage classes (in, const, immutable, shared, inout) are also ignored.

void foo(T)(const T value) if (!is(T == int)) {}
void main()
{
    int n;
    const int cn;
    static assert(!__traits(compiles, foo(n)));     // OK
    static assert(!__traits(compiles, foo(cn)));    // NG
}

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



https://github.com/D-Programming-Language/dmd/pull/425
https://github.com/D-Programming-Language/druntime/pull/78
https://github.com/D-Programming-Language/phobos/pull/284

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



11:23:33 PST ---
https://github.com/D-Programming-Language/dmd/commit/9b9f422242b9855007e5ee73ed90457b78552b0e

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6aa5805f571be5a2d393f83cbe5dd9354c366067
fix Issue 6208 with tuple parameter deduction in IFTI.

If a function parameter using tuple template parameter has some storage
classes, the its whole matching level should be the worst of each tuple
elements.

https://github.com/D-Programming-Language/dmd/commit/4cc9491baabd8936933ff6b338e9a9c3a919735f


fix Issue 6208 with tuple parameter deduction in IFTI.

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