digitalmars.D.bugs - [Issue 7154] New: [CTFE] failing downcast causes error
- d-bugmail puremagic.com (35/35) Dec 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7154
- d-bugmail puremagic.com (12/12) Dec 26 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7154
http://d.puremagic.com/issues/show_bug.cgi?id=7154 Summary: [CTFE] failing downcast causes error Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: maehlvis googlemail.com --- Comment #0 from Elvis Maehren <maehlvis googlemail.com> 2011-12-22 07:45:40 PST --- At runtime, a failing downcast evaluates to null. At compile time, it gives an error: "Error: cannot reinterpret class from C to test.B at compile time" It should just evaluate to null, too. --- class A {} class B : A {} class C : A {} bool test(T)() { A a = new T; return (cast(B) a) !is null; } void main() { assert(test!B()); // ok assert(!test!C()); // ok static assert(test!B()); // ok static assert(!test!C()); // error } --- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7154 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED --- Comment #1 from Don <clugdbug yahoo.com.au> 2011-12-26 16:03:28 PST --- https://github.com/D-Programming-Language/dmd/commit/15039d5284922ac673023da65827460972ba60b3 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 26 2011