www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19857] New: Name mangling mismatch when compiling with -dip1000

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

          Issue ID: 19857
           Summary: Name mangling mismatch when compiling with -dip1000
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: greeenify gmail.com

```
struct Stack(T)
{
 safe:
    T[] data;
     property ref T top()
    {
        return data[$ - 1];
    }
}

void main()
{
    auto s = Stack!(int[])();
    auto b = s.top();
}
```

How to test:

dmd -c test.d -oftest.o
dmd -c -dip1000 test.d -oftest1000.o
nm test.o > test.names
nm test1000.o > test1000.names
diff -u test.names test1000.names

--- test.names  2019-05-09 11:49:20.545433782 +0100
+++ test1000.names      2019-05-09 11:49:24.042133904 +0100
   -15,7 +15,7   
 0000000000000000 V _D30TypeInfo_S4test__T5StackTAiZQk6__initZ
 0000000000000000 R _D4test12__ModuleInfoZ
 0000000000000000 W
_D4test__T5StackTAiZQk11__xopEqualsFKxSQBl__TQBjTQBgZQBrKxQuZb
-0000000000000000 W _D4test__T5StackTAiZQk3topMFNaNbNcNdNiNfZQy
+0000000000000000 W _D4test__T5StackTAiZQk3topMFNaNbNcNdNiNjNfZQBa
 0000000000000000 V _D4test__T5StackTAiZQk6__initZ
 0000000000000000 W _D4test__T5StackTAiZQk9__xtoHashFNbNeKxSQBm__TQBkTQBhZQBsZm
 0000000000000000 V _D6object__T10RTInfoImplVAmA2i16i2ZQxyG2m
```

Demangled:

```
--- test.names  2019-05-09 11:49:20.545433782 +0100
+++ test1000.names      2019-05-09 11:49:24.042133904 +0100
   -15,7 +15,7   
 0000000000000000 V TypeInfo_S4test__T5StackTAiZQk.__init
 0000000000000000 R test.__ModuleInfo
 0000000000000000 W bool test.Stack!(int[]).Stack.__xopEquals(ref
const(test.Stack!(int[]).Stack), ref const(test.Stack!(int[]).Stack))
-0000000000000000 W pure nothrow ref  property  nogc  safe int[]
test.Stack!(int[]).Stack.top()
+0000000000000000 W pure nothrow ref  property  nogc return  safe int[]
test.Stack!(int[]).Stack.top()
 0000000000000000 V test.Stack!(int[]).Stack.__init
 0000000000000000 W nothrow  trusted ulong
test.Stack!(int[]).Stack.__xtoHash(ref const(test.Stack!(int[]).Stack))
 0000000000000000 V immutable(ulong[2]) object.RTInfoImpl!([16, 2]).RTInfoImpl
```

--
May 09 2019