Thread overview
[Issue 6208] New: Parameter storage classes are ignored in template function deducing.
Jun 24, 2011
Kenji Hara
Jun 24, 2011
Kenji Hara
Sep 08, 2011
Kenji Hara
Oct 02, 2011
Kenji Hara
Dec 15, 2011
Walter Bright
June 24, 2011
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


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-24 09:00:09 PDT ---
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: -------
June 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6208



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-24 09:01:35 PDT ---
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: -------
September 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6208



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-09-08 00:52:07 PDT ---
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: -------
October 02, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6208


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

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


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-02 14:52:49 PDT ---
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: -------
December 15, 2011
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


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-12-15 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: -------
February 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6208



--- Comment #5 from github-bugzilla@puremagic.com 2012-02-11 10:15:57 PST ---
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 Merge pull request #709 from 9rnsr/fix6208_for_tuple

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