www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24113] New: Eager failure of TypeInfo in _d_newclassT even if

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

          Issue ID: 24113
           Summary: Eager failure of TypeInfo in _d_newclassT even if not
                    used in -betterC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: alphaglosined gmail.com

Linux Mint 21.2, dmd 2.105. This works on dmd with dmd 2.105-beta1

```
/usr/include/dmd/druntime/import/core/lifetime.d(2761,42): Error: `TypeInfo`
cannot be used with -betterC
```

This corresponds to the function ``_d_newclassT``.

It seems ``_d_newclassT`` is imported by object.d via

```d
public import core.lifetime : _d_newitemT;
```

Versioning out the import from object.d stops this error. This is rather
curious as classes should generate a different error if it were used and that
hook function is templated.

Replacing it with a deprecated function, results in no deprecations.

--
Aug 27 2023