Bug 7469 – template mangling depends on instantiation order

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-08T20:26:00Z
Last change time
2015-09-03T05:29:45Z
Keywords
pull, wrong-code
Assigned to
code
Creator
code

Comments

Comment #0 by code — 2012-02-08T20:26:03Z
---- bug.d ---- struct Foo(int i) { } version (A) { Foo!3 fooa; Foo!3u foob; } else { Foo!3u fooa; Foo!3 foob; } pragma(msg, typeof(fooa).mangleof); pragma(msg, typeof(foob).mangleof); ---- dmd -c bug.d S3bug11__T3FooVk3Z3Foo S3bug11__T3FooVk3Z3Foo ---- dmd -c -version=A bug.d S3bug11__T3FooVi3Z3Foo S3bug11__T3FooVi3Z3Foo ---- The mangling should depend on the template value parameter type not the type of the argument.
Comment #1 by code — 2012-02-09T04:36:14Z
cat > bug.d << EOF struct S128(T, int k=1) { } version (A) { alias S128!(int) fooa; alias S128!(int, 1) foob; } else { alias S128!(int, 1) fooa; alias S128!(int) foob; } pragma(msg, fooa.mangleof); pragma(msg, foob.mangleof); EOF dmd -c bug.d dmd -c -version=A bug.d ---- S3bug14__T4S128TiVi1Z4S128 S3bug14__T4S128TiVi1Z4S128 ---- S3bug11__T4S128TiZ4S128 S3bug11__T4S128TiZ4S128 ---- Similar bug with default values.
Comment #2 by code — 2012-03-09T19:05:41Z
Comment #3 by code — 2013-10-13T16:34:55Z
Fixing this issue would allow us to use the mangling as hash key for looking up existing template instantiations. Currently the template arguments are used for comparison and to compute the hash (TemplateDeclaration::findExistingInstance).
Comment #4 by k.hara.pg — 2014-01-28T22:53:10Z
*** Issue 12020 has been marked as a duplicate of this issue. ***
Comment #5 by k.hara.pg — 2014-05-09T18:31:34Z
*** Issue 12720 has been marked as a duplicate of this issue. ***
Comment #6 by k.hara.pg — 2014-05-09T19:11:02Z
https://github.com/D-Programming-Language/dmd/pull/3536 I think this is important to stabilize symbol mangling. Change to 'major' bug.
Comment #7 by github-bugzilla — 2014-05-09T19:38:08Z
Comment #8 by github-bugzilla — 2014-05-09T22:40:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/cc5029603a0ce7051b7e24642705c1d8ec6c5e02 fix Issue 7469 - template mangling depends on instantiation order https://github.com/D-Programming-Language/dmd/commit/5c5bd27f748e5b2b095915bfd187ab7561d6d142 Merge pull request #3536 from 9rnsr/fix7469 Issue 7469 - template mangling depends on instantiation order
Comment #9 by github-bugzilla — 2014-05-24T09:14:38Z
Comment #10 by k.hara.pg — 2015-01-06T08:40:26Z
*** Issue 10914 has been marked as a duplicate of this issue. ***
Comment #11 by k.hara.pg — 2015-09-03T05:29:45Z
*** Issue 12696 has been marked as a duplicate of this issue. ***