[Issue 14093] [REG2.065] __traits(compiles, cast(Object)(tuple)) is true even if it doesn't compile.
https://issues.dlang.org/show_bug.cgi?id=14093 Igor Stepanov wazar.leoll...@yahoo.com changed: What|Removed |Added Status|RESOLVED|REOPENED CC||wazar.leoll...@yahoo.com Resolution|FIXED |--- --- Comment #6 from Igor Stepanov wazar.leoll...@yahoo.com --- This issue is not fully solved. There is simpler example: - struct FooBar { int a; int b; } void test14093() { FooBar foo; auto obj = cast(Object)foo; //e2ir: cannot cast foo of type FooBar to type object.Object } - Moreover, I think, this issue is solved incorrectly: alias this mechanism should reject `cast(Object)(point._tupleAliasThis_)` variant and continue process the root casting cast(Object)point excluding alias this. And result error message should be Error: cannot cast expression point of type Tuple!(int, x, int, y) to object.Object. We are interested in subtyping (alias this, or inheritance) only when it can done its work (casting, .member ...). --
[Issue 14624] New: The array operator overloading fallback is not correct
https://issues.dlang.org/show_bug.cgi?id=14624 Issue ID: 14624 Summary: The array operator overloading fallback is not correct Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: wrong-code Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: k.hara...@gmail.com Test case: struct A1 { int x; ref int opIndex() { return x; } ref int opSlice() { assert(0); } } void main() { A1 a = A1(1); auto x = a[]; // a.opIndex(), OK assert(x == a.x); // When a.opIndexUnary!- is not found, // it should be rewritten to: -a.opIndex() rather than -a.opSlice() auto y = -a[]; // asserts in opSlice(), NG assert(y == -a.x); // When a.opIndexAssign(int) is not found, // it should be rewritten to: a.opIndex() = 1; rather than a.opSlice() = 1; a[] = 1;// asserts in opSlice(), NG assert(a.x == 1); // When a.opIndexOpAssign!+(int) is not found, // it should be rewritten to: a.opIndex() += 1; rather than a.opSlice() += 1; a[] += 1; // asserts in opSlice(), NG assert(a.x == 2); } I caught the issue in the d.learn forum thread that was posted a half year ago: http://forum.dlang.org/post/luadir$t0g$1...@digitalmars.com --
[Issue 14623] New: Checking for in-flight exceptions at runtime
https://issues.dlang.org/show_bug.cgi?id=14623 Issue ID: 14623 Summary: Checking for in-flight exceptions at runtime Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: marki...@umich.edu We should have a function that allows you to see if there are exceptions currently in flight. Brought this up at DConf and Andrei suggested that it should be a runtime function and that we might already have a lot of the machinery to make this happen. He also referenced what C++ is working on for this: http://en.cppreference.com/w/cpp/error/uncaught_exception An example: struct Foo { ~this() { if (we_are_unwinding_due_to_an_exception) { logSomeStuff(); } } } --
[Issue 14625] New: opIndex() doesn't work on foreach container iteration
https://issues.dlang.org/show_bug.cgi?id=14625 Issue ID: 14625 Summary: opIndex() doesn't work on foreach container iteration Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: k.hara...@gmail.com A non-range container object iteration `foreach (e; c)` is implicitly converted to a range iteration, by application of implicit slicing like as `foreach (e; c[])`. (Maybe the feature is not well documented in website? http://dlang.org/statement#foreach-with-ranges ) struct Range { @property bool empty() { return true; } @property int front() { return 0; } void popFront() {} } struct Container { Range opSlice() { return Range(); } } void main() { Container c; foreach (e; c) {} } On the other hand, new integrated array operator overloading says as follows: http://dlang.org/operatoroverloading#Slice To overload a[], simply define opIndex with no parameters: But, it does not work on the container iteration. Test case is: // Range struct is same as above struct Container { Range opIndex() { return Range(); } Range opSlice() { assert(0); } } void main() { Container c; //foreach (e; c) {} // asserts in opSlice(), NG foreach (e; c[]) {} // calls c.opIndex(), OK } The orignal post in d.learn forum: http://forum.dlang.org/thread/vhsyxrroterdmqpgc...@forum.dlang.org --