D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14401 - typeid(shared X).init is empty for class types
Summary: typeid(shared X).init is empty for class types
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P1 blocker
Assignee: No Owner
URL:
Keywords: pull, wrong-code
Depends on:
Blocks:
 
Reported: 2015-04-03 05:20 UTC by Andrei Alexandrescu
Modified: 2017-07-19 17:42 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2015-04-03 05:20:57 UTC
Consider:

class X
{
    int a;
}

void main()
{
    import std.stdio;
    writeln(typeid(X).init.length);
    writeln(typeid(shared(X)).init.length);
}

The program prints 20 and 0.

This is a blocker for work on std.allocator.
Comment 1 Kenji Hara 2015-04-03 19:03:54 UTC
The root problem is in the definition of TypeInfo_Class. So it's a druntime issue.

https://github.com/D-Programming-Language/druntime/pull/1205
https://github.com/D-Programming-Language/phobos/pull/3143
Comment 2 github-bugzilla 2015-04-03 19:30:53 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/9f68938b8f3420d676e5231867c82101ef5d1c81
Supplemental fix for issue 14401 - Deal with the type change of typeid(ClassType).init to const(void)[]

https://github.com/D-Programming-Language/phobos/commit/3ffc006c20d759ad7197eae879cc894f7bb5efbb
Merge pull request #3143 from 9rnsr/fix14401

Supplemental fix for issue 14401 - Deal with the type change of typeid(ClassType).init to const(void)[]
Comment 3 github-bugzilla 2015-04-03 20:29:23 UTC
Commits pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/6fa857d5535d52df08fb93ae975ee864101537b0
fix Issue 14401 - typeid(shared X).init is empty for class types

`TypeInfo_Class` needs to override `init()` method for the `TypeInfo_Const` and its derived TypeInfo classes.

https://github.com/D-Programming-Language/druntime/commit/bd3f4cb2122edd1a7c107f86936c20bba15191b6
Merge pull request #1205 from 9rnsr/fix14401

Issue 14401 - typeid(shared X).init is empty for class types
Comment 4 github-bugzilla 2015-04-09 01:08:41 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/94f725f3f56df4257647e348184586a1661f60cf
fix root/rmem.d to follow issue 14401 fix in druntime.

https://github.com/D-Programming-Language/dmd/commit/7f8f27c9520c559190d5ac366cd337f9ef5c597b
Merge pull request #4572 from 9rnsr/fix14401

fix root/rmem.d to follow issue 14401 fix in druntime.
Comment 7 github-bugzilla 2017-07-19 17:41:19 UTC
Commits pushed to dmd-cxx at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/6fa857d5535d52df08fb93ae975ee864101537b0
fix Issue 14401 - typeid(shared X).init is empty for class types

https://github.com/dlang/druntime/commit/bd3f4cb2122edd1a7c107f86936c20bba15191b6
Merge pull request #1205 from 9rnsr/fix14401
Comment 8 github-bugzilla 2017-07-19 17:42:56 UTC
Commits pushed to dmd-cxx at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9f68938b8f3420d676e5231867c82101ef5d1c81
Supplemental fix for issue 14401 - Deal with the type change of typeid(ClassType).init to const(void)[]

https://github.com/dlang/phobos/commit/3ffc006c20d759ad7197eae879cc894f7bb5efbb
Merge pull request #3143 from 9rnsr/fix14401