D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4297 - Nothrow functions cannot use constant dynamic array
Summary: Nothrow functions cannot use constant dynamic array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on: 3864 4298
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-08 15:32 UTC by Shin Fujishiro
Modified: 2014-02-15 02:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2010-06-08 15:32:21 UTC
DMD rejects nothrow functions which use compile-time constant dynamic array for violating nothrow.

--------------------
immutable TABLE = [ 1, 2, 3 ];
pragma(msg, typeof(TABLE)); // immutable(int[])

void foo() nothrow
    // Error: function test.foo 'foo' is nothrow yet may throw
{
    const(int)[] tab;
    tab = TABLE;
}
--------------------

The error does not occur if TABLE is declared with auto or immutable int[3] (instead of mere "immutable").
Comment 1 Don 2010-11-03 06:35:59 UTC
Fixed svn 736.