www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4594] New: itfi fails to detect correct types in the face of differing qualifiers

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

           Summary: itfi fails to detect correct types in the face of
                    differing qualifiers
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: braddr puremagic.com



---
module test;

void main()
{
    int[] foos;
    func1(foos);
}

void func1(T)(const T[] foos)
{
    T afoo;
    func2(foos, afoo);
}

void func2(T)(const T[] foos, out T afoo)
{
}

$ dmd -c test.d
test.d(12): Error: template test.func2(T) does not match any function template
declaration
test.d(12): Error: template test.func2(T) cannot deduce template function from
argument types !()(const(int[]),int)
test.d(6): Error: template instance test.func1!(int) error instantiating

From don, changing func2 to:

void func2(T, U)(const T[] foos, out U afoo)
{
   static assert(is(T==U));
}

Results in:
test0.d(212): Error: static assert  (is(const(int) == int)) is false
test0.d(207):        instantiated from here: func2!(const(int),int)
test0.d(201):        instantiated from here: func1!(int)

T should be "int" instead of "const(int)".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 07 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4594


Michal Minich <michal.minich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michal.minich gmail.com



PDT ---
simpler test case

void bar(T)(const T x, T y) {}

void main () {
    const int s1;      
    int s2;

    bar!(const int)(s1, s2); // pass ok
    bar!(int)(s1, s2); // pass ok
    bar(s1, s2); // error   
}

Error: template bar(T) does not match any function template declaration

Error: template bar(T) cannot deduce template function from argument types
!()(const(int),int)

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


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 2594 ***

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