Bug 2260 – Template uniqueness not valid anymore from 1.031 to 1.033

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2008-08-01T05:59:00Z
Last change time
2014-03-01T00:35:51Z
Keywords
wrong-code
Assigned to
nobody
Creator
walter

Comments

Comment #0 by walter — 2008-08-01T05:59:38Z
The following template-chain does not work correctly, when applied multiple times: > class inner (alias F) { } > > template outer(alias B) > { > void function( inner!(B) ) outer; > } > > template rawmanglednameof(alias A) > { > const char[] rawmanglednameof = typeof(&outer!(A)).mangleof; > } > > Stdout.formatln ("{}", rawmanglednameof !(func)); > Stdout.formatln ("{}", rawmanglednameof !(args)); > > // results in > > PPFC4Test35__T5innerS22_D4Test4funcFiJiKiLiYvZ5innerZv > PPFC4Test35__T5innerS22_D4Test4funcFiJiKiLiYvZ5innerZv > > // in dmd-1.033 it correctly was: > > PPFC4Test35__T5innerS22_D4Test4funcFiJiKiLiYvZ5innerZv > PPFC4Test39__T5innerS26_D4Test4mainFAAaZi4argsAAaZ5innerZv So it seems, the template is not unique anymore! This bug is confirmed by Don Clugston and it is necessary to work for the compile-time demanglers in dsource/ddl/meta and dsource/meta projects.
Comment #1 by smjg — 2008-11-24T09:04:59Z
Eh, what are func and args? Absent any declarations of these, the code shouldn't compile. Please make sure your testcases are complete and self-contained.
Comment #2 by walter — 2008-12-30T04:27:46Z
import tango.io.Stdout; class inner (alias F) { } template outer(alias B) { void function( inner!(B) ) outer; } template rawmanglednameof(alias A) { const char[] rawmanglednameof = typeof(&outer!(A)).mangleof; } void func (int i, out int j, ref int k, lazy int m, ...) { } int main (char[][] args) { Stdout.formatln ("{}", rawmanglednameof !(func)); Stdout.formatln ("{}", rawmanglednameof !(args)); return 0; } Okay, this one compiles with Tango. For Phobos you can just replace the Stdout.formatln by its writefln equivalent. The bug is not library dependent.
Comment #3 by clugdbug — 2009-08-07T02:46:10Z
This is working in 2.031 and 1.046. I suspect it was fixed some time ago.