Bug 7064 – .stringof of eponymous struct/class/interface template

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-04T07:33:55Z
Last change time
2021-01-24T12:30:14Z
Assigned to
No Owner
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2011-12-04T07:33:55Z
struct S(T){int x;} template X(T){ struct S{int x;} } void main(){ pragma(msg, S!int); // "struct S" pragma(msg, X!int); // X!(int) pragma(msg, X!int.S); // "S", why not identical to first one? } The fact that for eponymous templates the template parameters are not shown sometimes has a severe negative impact on the readability of error messages, as well as on the usefulness of debug output via pragma(msg) I propose that .stringof for eponymous templates should apply to the template instance instead of to the eponymous declaration.
Comment #1 by timon.gehr — 2011-12-04T07:36:43Z
But that should only be the case for templated types, for example the following should still print "1": template X(int x) { enum X = x; } pragma(msg, X!1);
Comment #2 by maxhaton — 2021-01-24T06:40:38Z
No longer reproducible in '21