Error I can't fix
wron
wron at mail.com
Sat Oct 10 11:01:54 UTC 2026
On Saturday, 10 October 2026 at 06:59:07 UTC, wron wrote:
> I have a struct
> ```
> struct Dorm
> {
> string foo;
> string baz;
> int bar;
> Nullable!bool fooxbool;
> }
> ```
>
> trying to get typeof each member with
> ```
> class Test
> {
> auto stMems(T)()
> {
> alias members = __traits(allMembers, T);
> foreach (member; members)
> {
> alias m = __traits(getMember, T, member);
> alias mtype = typeof(m);
>
> writeln(mtype.stringof);
> }
> }
> }
>
> ```
> i get the error ```Error: type `DontCallDestructorT` is not an
> expression
> alias mtype = typeof(m);```
> i have no `DontCallDestructorT` in my code
>
> removing the Nullable works as expected. what do i do
Sorry guys I've seen the issue. I was recursively checking
structs `static if (is(mtype == struct))
` (did not put this in example), my code found Nullable (a
struct) defined as
```
struct Nullable(T)
{
private union DontCallDestructorT
{
import std.traits : hasIndirections;
static if (hasIndirections!T)
T payload;
else
T payload = void;
}
private DontCallDestructorT _value = DontCallDestructorT.init;
...
}
```
More information about the Digitalmars-d-learn
mailing list