[Issue 8651] Slice op Slice throws exceptions (not errors), and nothrow
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 17 00:10:01 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651
--- Comment #5 from monarchdodra at gmail.com 2012-12-17 00:10:00 PST ---
(In reply to comment #0)
> 2 related problems:
>
> First
> --------
> import std.stdio;
> void main()
> {
> try
> {
> int[] b = new int[](10);
> b[] = 5;
> b[0..6] = b[4..10];
> }
> catch(Exception e)
> {
> writeln(e);
> }
> writeln("finish");
> }
> --------
> The built-in range assign will throw an Exception when it fails. This should be
> an Error.
Confirmed fixed.
> Second
> --------
> nothrow void foo(int[] a)
> {
> a[] = a[];
> }
>
> nothrow void bar(int[] a)
> {
> a[] += a[];
> }
> --------
> _arraySliceSliceAddass_i is not nothrow
> function main.bar 'bar' is nothrow yet may throw
> --------
> This is doubly problematic:
> First, these methods should throw Errors, so the code should compile.
> Two, ironically, []+=[] currently doesn't throw anything, and []=[] throws an
> exception, yet it is the []+=[] version that doesn't compile.
!!!!!!!!
This is NOT FIXED.
!!!!!!!!
This is very strange, because arraySliceSliceAddass_i *is* marked as nothrow.
However, when calling "a[] += a[]", I still get:
----
Error: _arraySliceSliceAddass_l is not nothrow
----
I'm not sure what to make about this? Maybe the "nothrow" info is lost in the
"extern C" ?
If I place the code as a unittest *inside* "src/rt/arrayint.d", then it passes.
But outside of that source, then... It doesn't compile.
We'd need one of the compiler guys (or just people that understand C and
linking better than I do) to investigate.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list