Please consider:
```
void main() {

   import std.stdio;

   struct foo {

      int  foo1;
      char foo2;
   }
   foo*   fooptr;

   void*  genptr;


   static if (is(typeof(fooptr) == void*))
             writeln("fooptr is void*");
          else
             writeln("fooptr is not void*");

   static if (is(typeof(fooptr) == foo*))
             writeln("fooptr is foo*");
          else
             writeln("fooptr is not foo*");

   static if (is(typeof(genptr) == void*))
             writeln("genptr is void*");
          else
             writeln("genptr is not void*");
}
```
which produces:
```
fooptr is not void*
fooptr is foo*
genptr is void*
```

Since `void*` variables accept _all_ pointer types, I expected to see `fooptr is void*`.

Is there any way of picking up, at compile-time, all pointer types in one test?

  • compile-time det... DLearner via Digitalmars-d-learn

Reply via email to