www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2410] New: array's invariant storage class dropped by a template

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

           Summary: array's invariant storage class dropped by a template
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: marcin.wcislo gmail.com


This snippet compiles correctly:

class Class {
    void foo(int[2] arg) {}
    void foo(invariant(int[2]) arg) {}
}

int main() {
    (new Class).foo([1, 1]);
    return 0;
}

(foo call is linked to foo(int[2]))

But this not:

class Class(T, int n) {
        void foo(T[n] arg) {}
        void foo(invariant(T[n]) arg) {}
}

int main() {
        (new Class!(int, 2)).foo([1, 1]);
        return 0;
}

error:
template.d(x): function template.Class!(int,2).Class.foo called with argument
types:
        (int[2u])
matches both:
        template.Class!(int,2).Class.foo(int[2u])
and:
        template.Class!(int,2).Class.foo(int[2u])


-- 
Oct 09 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2410


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
         OS/Version|Linux                       |All





That the compiler prints "x" instead of a line number is a bug indeed.  Are
there others like this?  At least this one's been fixed (trying on 2.023 Win),
unless it's Linux-specific.


-- 
Jan 10 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2410


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED



Works correctly in dmd 2.053

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 10 2011