D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14592 - [SPEC] Undocumented use of __U for mangling template constraints
Summary: [SPEC] Undocumented use of __U for mangling template constraints
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 major
Assignee: No Owner
URL:
Keywords: spec
Depends on:
Blocks:
 
Reported: 2015-05-16 12:33 UTC by Iain Buclaw
Modified: 2015-05-17 12:30 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 Iain Buclaw 2015-05-16 12:33:25 UTC
I've never come across it, so maybe it's just dead code in DMD.
Comment 1 Kenji Hara 2015-05-16 15:55:22 UTC
> 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 Iain Buclaw 2015-05-16 17:22:21 UTC
(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 Kenji Hara 2015-05-17 12:03:21 UTC
(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 Iain Buclaw 2015-05-17 12:30:58 UTC
(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.