Bug 13846 – Tuple behavior incorrect

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-12-09T20:20:00Z
Last change time
2014-12-10T01:39:01Z
Assigned to
nobody
Creator
phil.burr

Comments

Comment #0 by phil.burr — 2014-12-09T20:20:09Z
DMD32 D Compiler v2.066.0 Copyright (c) 1999-2014 by Digital Mars written by Walter Bright Documentation: http://dlang.org/ I'm not sure entirely how to describe the bug, other than with code. I've reduced the bug to the following: import std.typecons; struct Bar { Tuple!(string, Bar) bar[]; } struct Foo { Tuple!(string, Bar) bar[]; } void main() { auto t0 = tuple("test", Foo()); auto t1 = tuple("test", Bar()); assert(t0[0] == "test"); assert(t1[0] == "test"); } The first assertion (t0[0] == "test") succeeds whereas the second assertion (t1[0] == "test") fails. The difference between the two is that Bar contains a tuple that references itself where as Foo contains a tuple that references a different type. C:\>rdmd test.d [email protected](18): Assertion failure ---------------- 0x004065F3 0x004020EE 0x0040745E 0x00407433 0x00407349 0x00404CFB 0x7607919F in BaseThreadInitThunk 0x76FB0BBB in RtlInitializeExceptionChain 0x76FB0B91 in RtlInitializeExceptionChain
Comment #1 by k.hara.pg — 2014-12-10T01:39:01Z
The wrong-code bug is a dup of issue 13235, and it's fortunately fixed in the minor release 2.066.1. *** This issue has been marked as a duplicate of issue 13235 ***