digitalmars.D.bugs - [Issue 12927] New: Can't get at compile-time the immutable field of
- via Digitalmars-d-bugs (34/34) Jun 15 2014 https://issues.dlang.org/show_bug.cgi?id=12927
https://issues.dlang.org/show_bug.cgi?id=12927 Issue ID: 12927 Summary: Can't get at compile-time the immutable field of a struct instance in a TypeTuple Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: rejects-valid Severity: regression Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.cc I am not fully sure this code is valid, but this used to work until recently: alias TypeTuple(T...) = T; struct Foo { int a; immutable int b; } struct Bar { auto foos = TypeTuple!(Foo(10, 20), Foo(10, 20)); void bar() { enum i = 1; enum r = foos[i].b; } } void main() {} With dmd 2.066alpha it gives: temp.d(10,18): Error: value of 'this' is not known at compile time I use this idiom to have struct instances with some mutable fields and with some "enum" fields. --
Jun 15 2014