std.format and uninitialized elements in CTFE
berni44
dlang at d-ecke.de
Fri Dec 6 12:47:14 UTC 2019
On Friday, 6 December 2019 at 06:49:41 UTC, berni44 wrote:
> int a = void;
>
> static if (!__traits(compiles, a?a:a))
>
> But I'm not sure if ?: can be applied to all thinkable types.
Even that doesn't work (don't know, why I got this morning the
impression, that it does).
Is the following a bug in __traits?
```
struct Foo
{
int a = void;
}
int foo(Foo f)
{
static if (__traits(compiles, f.a == f.a))
{
if (f.a == f.a) return 1; // error
return 2;
}
return 3;
}
static x = foo(Foo());
```
More information about the Digitalmars-d
mailing list