Bug 10993 – mangling of voldemort types with lambdas changes during return type inference

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-08T01:55:00Z
Last change time
2013-09-22T22:03:12Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2013-09-08T01:55:52Z
Reduced from the cartesianProduct unittests: module test3; //import std.traits; auto foo(T)(T a) { static immutable typeof(a) q; pragma(msg, "foo: " ~ typeof(q).mangleof); return q; } struct test(alias fn) { bool ini = true; void* p; } auto fun() { auto x = foo!()(test!(a=>a)()); pragma(msg, "fun: " ~ typeof(x).mangleof); return x; //typeid(x); } void main() { const x = fun(); pragma(msg, "x : " ~ typeof(x).mangleof); auto y = cast()x; pragma(msg, "y : " ~ typeof(y).mangleof); } compile with "dmd test3.d" yields: foo: yS5test33fun32__T4testS205test33fun9__lambda2Z4test fun: yS5test33fun32__T4testS205test33fun9__lambda2Z4test x : yS5test33fun32__T4testS205test33fun9__lambda2Z4test y : S5test33funFZyS5test33fun32__T4testS205test33fun9__lambda2Z4test32__T4testS 205test33fun9__lambda2Z4test i.e. casting away immutable leads to a completely new mangling while it should have removed the 'y' at the start only. This causes link errors when trying to produce complete TypeInfo data.
Comment #1 by github-bugzilla — 2013-09-22T22:02:44Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/be57510ce308da696ed293d4acc4b233f3258b30 Merge pull request #2585 from rainers/issue10993 fix Issue 10993: mangling of voldemort types with lambdas changes during return type inference