The conversions of scalars to Fixed type now fails at compile time.
There are several similar bugs to which it might be connected.
I join a reduced tango and xf independent test case.
Possibly connected to this xf.omg.core.CoordSys (that includes LinearAlgebra) segfaults.
Comment #1 by fawzi — 2010-02-11T06:51:50Z
Created attachment 566
a testcase that fails
Comment #2 by matti.niemenmaa+dbugzilla — 2010-02-11T08:55:10Z
Reduced:
struct S {
int x;
template T(int val) {
const S T = { val };
}
}
const x = S.T!(0);
// arst.d(9): Error: non-constant expression (S).T
Comment #3 by fawzi — 2010-03-08T00:27:59Z
This bug is listed as fixed in 1.057, but while the reduced case by Matti Niemenmaa is indeed fixed, the original testcase still fails (I am pointing it out so that it stays open...)
Comment #4 by bugzilla — 2010-03-08T22:24:37Z
Fixed dmd 1.057
Comment #5 by fawzi — 2010-03-09T03:24:39Z
As I wrote in my previous comment, the attached testcase still fails...
Comment #6 by clugdbug — 2010-05-31T06:11:36Z
Reduced test case for the case that still fails. It's the same, except that the struct member is explicitly named in the struct initializer.
struct S {
int x;
template T(int val) {
const S T = { x: val };
}
}
const x = S.T!(0);
Comment #7 by clugdbug — 2010-06-24T13:55:11Z
The D2 version of this code never compiled without error.
struct S {
int x;
template T(int val) {
enum S T = { x: val };
}
}
const x = S.T!(0);
It fails to compile because init.c, StructInitializer::toExpression() returns NULL if any of the fields have names ( if (field.data[i]) goto Lno; )
And this is just because it's never been implemented.