www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21580] New: The D compiler adds an extra (void*) member in

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

          Issue ID: 21580
           Summary: The D compiler adds an extra (void*) member in
                    unittest
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: cr tagion.org

Created attachment 1814
  --> https://issues.dlang.org/attachment.cgi?id=1814&action=edit
Example

I discovered something odd when I put a struct into an unittest.

If you place a struct inside an unittest with a mixin template the compiler
adds an extract (void*) element to the struct.

carsten spaceship:/tmp> dmd unittest_odd_void_ptr.d -unittest
(int, string)
(int, string, void*)
(int, string)
carsten spaceship:/tmp> ldc2 unittest_odd_void_ptr.d -unittest
(int, string)
(int, string, void*)
(int, string)

See the attached code.

It is not a practical problem. I just found it a little odd and properly there
is an explanation.

Keep up the good work.
Best Regards
Carsten

--
Jan 25 2021