On Sunday, 14 January 2018 at 16:23:18 UTC, kdevel wrote:
Why does this compile while both of the commented lines give a
compile error.
The code boils down to this:
struct decimal32
{
this(int x) {}
}
immutable decimal32 c = 3; /* works */
void main ()
{
immutable decimal32 i = 1
vartmpl.d
```
import std.stdio : writeln;
import decimal : decimal32;
template F(T) {
immutable T c = 3;
}
void foo (T) ()
{
immutable T t = 1;
}
void main ()
{
// immutable decimal32 i = 1; // Error: none of the overloads
of '__ctor' are
callable using a immutable object
// foo!dec