www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17379] New: Mangle voldemort types as if they are defined in

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

          Issue ID: 17379
           Summary: Mangle voldemort types as if they are defined in the
                    outer scope to avoid exponential symbol name length
                    with templates
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: georgid outlook.com

This is related to PR 15831.

In this forum thread : http://forum.dlang.org/post/nhkje4$jlm$1 digitalmars.com
there a workaround this removes the exponential growth with a linear growth.

Example:

auto foo(T)(T t) if (someConstraints)
{
   static struct Result
   {
      T t;
   }
   return Result(t);
}

When changed to the functionally equivalent:

template(T) foo if (someConstraints)
{
   static struct Result
   {
      T t;
   }

   auto foo(T t)
   {
      return Result(t);
   }
}

The exponential growth is replaced with linear growth.

It would be very good if DMD lowers the first case to the second when mangling
voldemort types.

--
May 07