[Issue 13846] New: Tuple behavior incorrect
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Dec 9 12:20:09 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13846
Issue ID: 13846
Summary: Tuple behavior incorrect
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: phil.burr at gmail.com
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
core.exception.AssertError at test.d(18): Assertion failure
----------------
0x004065F3
0x004020EE
0x0040745E
0x00407433
0x00407349
0x00404CFB
0x7607919F in BaseThreadInitThunk
0x76FB0BBB in RtlInitializeExceptionChain
0x76FB0B91 in RtlInitializeExceptionChain
--
More information about the Digitalmars-d-bugs
mailing list