[Issue 12630] New: @nogc should recognize compile-time evaluation context
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 23 20:43:54 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12630
Issue ID: 12630
Summary: @nogc should recognize compile-time evaluation context
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: major
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: k.hara.pg at gmail.com
This code should be compiled with -o-, but doesn't.
void main() @nogc
{
static const ex1 = new Exception("invalid");
//enum ex2 = new Exception("invalid");
static const arr1 = [[1,2], [3, 4]];
enum arr2 = [[1,2], [3, 4]];
static const aa1 = [1:1, 2:2];
enum aa2 = [1:1, 2:2];
static const v1 = aa1[1];
enum v2 = aa2[1];
Object o;
static const del1 = (delete o).sizeof;
enum del2 = (delete o).sizeof;
int[] a;
static const len1 = (a.length = 1).sizeof;
enum len2 = (a.length = 1).sizeof;
static const cata1 = (a ~= 1).sizeof;
enum cata2 = (a ~= 1).sizeof;
static const cat1 = (a ~ a).sizeof;
enum cat2 = (a ~ a).sizeof;
}
--
More information about the Digitalmars-d-bugs
mailing list