Thread overview |
---|
November 14, 2008 [Issue 2454] New: tupleof(member) is incorrectly evaluated inside foreach over members-tuple | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2454 Summary: tupleof(member) is incorrectly evaluated inside foreach over members-tuple Product: D Version: 2.020 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: 2korden@gmail.com struct B { float i; double j; int k; void test() { foreach (m; this.tupleof) { writefln(typeof(m).stringof); } } } void main() { B b; b.test(); } -- |
November 14, 2008 [Issue 2454] tupleof(member) is incorrectly evaluated inside foreach over members-tuple | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2454 shro8822@vandals.uidaho.edu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |shro8822@vandals.uidaho.edu ------- Comment #1 from shro8822@vandals.uidaho.edu 2008-11-14 17:00 ------- If a struct has a member that is a struct, I would expect that this would work. As for non struct members, the logical thing to do would be to make that work anyway to avoid corner cases. Or are you saying the result of the tupleof is not what it should be? -- |
November 15, 2008 [Issue 2454] tupleof(member) is incorrectly evaluated inside foreach over members-tuple | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2454 ------- Comment #2 from 2korden@gmail.com 2008-11-14 18:50 ------- My bad, I forgot attaching the expected and actual result. Here they are: Expected output: float double int Actual output: float float float The tuple is ok, but foreach body "instantiated" incorrectly. -- |
November 15, 2008 [Issue 2454] typeof(object) is incorrectly evaluated | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2454 2korden@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|tupleof(member) is |typeof(object) is |incorrectly evaluated inside|incorrectly evaluated |foreach over members-tuple | ------- Comment #3 from 2korden@gmail.com 2008-11-14 19:42 ------- I believe this is relevant: import std.stdio; void foo(T)(T t) { assert(is(typeof(t) == T)); writeln(T.stringof); writefln(typeof(t).stringof); } struct A { int i; void test() { foreach (m; this.tupleof) { foo(m); // line 17 } } } void main() { foo(new A()); } Expected output: A* A* Actual output: A* int Looks like result of typeof(t) is evaluated just once at compile time and then reused at every template instantiation. Commenting line 17 hides the issue. -- |
November 15, 2008 [Issue 2454] typeof(object) is incorrectly evaluated | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2454 ------- Comment #4 from shro8822@vandals.uidaho.edu 2008-11-14 19:51 ------- What version? version: 1026 // what codepad.org uses float double int -- |
November 15, 2008 [Issue 2454] typeof(object) is incorrectly evaluated | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2454 ------- Comment #5 from 2korden@gmail.com 2008-11-14 19:54 ------- > Version: 2.020 -- |
July 28, 2010 [Issue 2454] typeof(object) is incorrectly evaluated | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2454 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |FIXED --- Comment #6 from Don <clugdbug@yahoo.com.au> 2010-07-28 13:21:29 PDT --- Fixed DMD2.023 (failed in 2.022). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation