[Issue 17379] New: Mangle voldemort types as if they are defined in the outer scope to avoid exponential symbol name length with templates

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 7 04:03:36 PDT 2017


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 at puremagic.com
          Reporter: georgid at 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.

--


More information about the Digitalmars-d-bugs mailing list