Bug 14592 – [SPEC] Undocumented use of __U for mangling template constraints
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-16T12:33:00Z
Last change time
2015-05-17T12:30:58Z
Keywords
spec
Assigned to
nobody
Creator
ibuclaw
Comments
Comment #0 by ibuclaw — 2015-05-16T12:33:25Z
I've never come across it, so maybe it's just dead code in DMD.
Comment #1 by k.hara.pg — 2015-05-16T15:55:22Z
> I've never come across it, so maybe it's just dead code in DMD.
__U is never used for any generated symbols, so it's not necessary to be documented in the spec.
But in dmd front-end, it's actually used internally for a *temporary* instance which used on evaluation of template constraint.
Comment #2 by ibuclaw — 2015-05-16T17:22:21Z
(In reply to Kenji Hara from comment #1)
> > I've never come across it, so maybe it's just dead code in DMD.
>
> __U is never used for any generated symbols, so it's not necessary to be
> documented in the spec.
>
> But in dmd front-end, it's actually used internally for a *temporary*
> instance which used on evaluation of template constraint.
OK, so long as that is a guarantee, that should be fine. I just bumped into it when looking for other things that have been bugging me with the way some things are mangled.
Could the __U be replaced with an @ ? That is one way to assert it never gets generated.
Comment #3 by k.hara.pg — 2015-05-17T12:03:21Z
(In reply to Iain Buclaw from comment #2)
> Could the __U be replaced with an @ ? That is one way to assert it never
> gets generated.
I think it's not so good idea. @ is used for never mangled things (e.g. Terror, Tinstance, etfc), but __U is *actually* used, even it's only for the internal structure.
A note for GDC and LDC: If a TemplateInstance object is "dummy" instance that using __U, its `members` field is NULL. In dmd code, it's excluded at ToObjFile visitor in toobj.c.
Comment #4 by ibuclaw — 2015-05-17T12:30:58Z
(In reply to Kenji Hara from comment #3)
> (In reply to Iain Buclaw from comment #2)
> > Could the __U be replaced with an @ ? That is one way to assert it never
> > gets generated.
>
> I think it's not so good idea. @ is used for never mangled things (e.g.
> Terror, Tinstance, etfc), but __U is *actually* used, even it's only for the
> internal structure.
>
> A note for GDC and LDC: If a TemplateInstance object is "dummy" instance
> that using __U, its `members` field is NULL. In dmd code, it's excluded at
> ToObjFile visitor in toobj.c.
OK, noted and will look into that. Suppose there's nothing left here to talk about.