www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12720] New: Non-int integral template parameters not mangled

https://issues.dlang.org/show_bug.cgi?id=12720

          Issue ID: 12720
           Summary: Non-int integral template parameters not mangled
                    correctly
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: kai redstar.de

This is a followup of fixed issue 3467. The name mangling is still wrong.

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

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

The bar function of

foo!( 4 ) baz

is mangled as

_D7bug346712__T3fooVii4Z3foo3barMFNaNbNiNfZS7bug346712__T3fooVii4Z3foo

but bar function of

foo!( 4L ) baz

is mangled as

_D7bug346712__T3fooVli4Z3foo3barMFNaNbNiNfZS7bug346712__T3fooVli4Z3foo

In both cases, I would expect

_D7bug346712__T3fooVmi4Z3foo3barMFNaNbNiNfZS7bug346712__T3fooVmi4Z3foo

because the type parameter is ulong.

There is a partial fix in the source (template.c, around line 7249) but this
does not compile.

--
May 08 2014