www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19392] New: [CTFE] static array in a tuple has not is not

https://issues.dlang.org/show_bug.cgi?id=19392

          Issue ID: 19392
           Summary: [CTFE] static array in a tuple has not is not
                    CTFE-able
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

import std.meta;

alias A = AliasSeq!(int[1]);
struct S { A a; }

S foo()
{
    A s;
    s[0][0] = 1;
    return S(s);
}

static assert(foo.a[0][0] == 1);

------------------
onlineapp.d(9): Error: variable __s_field_0 cannot be read at compile time
onlineapp.d(13):        called from here: foo()
onlineapp.d(13):        while evaluating: static assert(foo().__a_field_0[0] ==
1)

--
Nov 12 2018