www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3467] New: Non-int integral template parameters not correctly propagated

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

           Summary: Non-int integral template parameters not correctly
                    propagated
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras gmail.com> 2009-11-02 02:56:38
PST ---
The below code snippet fails to compile on DMD 2.035:

Error: cannot implicitly convert expression (baz.barof type foo!(n) to foo!(4)

Now change uint to int, and everything works perfectly. This might have to do
with literal types ( 4 is an int, not a uint, ulong, byte, or whatever ).

struct foo( uint n ) {
    foo!( n ) bar( ) {
        typeof( return ) result;
        return result;
    }
}

void main( ) {
    foo!( 4 ) baz;
    baz = baz.bar;// FAIL
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3467


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2010-09-25 16:29:51 PDT ---
The bug is present in dmd 2.049 still:


struct Vec(size_t N) {
    void opBinary(string op:"~", size_t M)(Vec!M) {}
}
void main() {
    Vec!2 a1;
    Vec!3 a2;
    a1 ~ a2; // line 7, Error
}

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