Thread overview
[Issue 18833] [REG 2.073] DMD in some cases forgets to generate wrapping TypeInfo for modifiers on classes
May 14, 2018
Walter Bright
May 25, 2018
Mike Franklin
May 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18833

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
Since this is marked as a regression, when did it work?

--
May 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18833

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
I assumed since I reduced this from issue 17968 that it has the same regression point (i.e. 2.073 is when it regressed). I just now tested locally and indeed, 2.073.0 shows the failure, while 2.072.2 does not.

--
May 25, 2018
https://issues.dlang.org/show_bug.cgi?id=18833

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150@yahoo.com

--- Comment #3 from Mike Franklin <slavo5150@yahoo.com> ---
I'm still trying to grok this, but from what I gather it sounds like
`genTypeInfo`
(https://github.com/dlang/dmd/blob/aa8fc584b92e736290f359596ec9e0aae857ae2c/src/dmd/typinf.d#L35)
is not being run for one of the types (the template instantiation in the
imported module?).

To fix, you may just need to enable logging in the compiler and find the appropriate place to call `genTypeInfo`.  grep for `genTypeInfo` to find usage examples in the source code.  There are quite a few.

--
May 25, 2018
https://issues.dlang.org/show_bug.cgi?id=18833

--- Comment #4 from Steven Schveighoffer <schveiguy@yahoo.com> ---
Mike,

We worked through all that at dconf (including putting your recommended print statements, etc). What is happening is that the call to see if dmd should generate the TypeInfo *is* made, but the compiler decides it doesn't have to because it believes the TypeInfo has already been generated in the imported module.

The real problem here is that the compiler treats the class typeinfo that has the const flag set identically to how it treats the class typeinfo that doesn't have the const flag set. In other words, it elides generating the Const_TypeInfo wrapper because it has already generated the TypeInfo_Class.

It's really difficult to explain, but look at the function in dsymbolsem.d that sets the instantiated module to null.

Then look at typinf.d for isSpeculativeType.

The decision not to generate the Const_TypeInfo is confused with the decision not to instantiate the class that it wraps. I don't know how to extract them into 2 separate decisions, which is why I'm not the one to solve this. Still getting my feet wet with DMD development.

--
December 13
https://issues.dlang.org/show_bug.cgi?id=18833

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19432

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--