static if - unexpected results

DLearner bmqazwsx123 at gmail.com
Fri Jun 23 16:13:03 UTC 2023


On Friday, 23 June 2023 at 15:48:44 UTC, H. S. Teoh wrote:
> On Friday, 23 June 2023 at 15:22:36 UTC, DLearner wrote:
>> On Friday, 23 June 2023 at 14:31:45 UTC, FeepingCreature wrote:
>>> On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote:
>> [...]
>>>
>>> ```
>>> static assert(__traits(isPOD, int)); // ok.
>>> static assert(__traits(isPOD, byte)); // ok.
>>> ```
>>> It's a bug in either the spec or the compiler.
>>
>> I am using
>> ```
>> DMD64 D Compiler v2.103.0-dirty
>>
>> ```
>> under
>>  ```
>> Windows [Version 10.0.19045.3086]
>> ```
>>
>> Do I need to report this anywhere?
>
> Tested your original code on latest dmd git master, here's the 
> output:
>
> ````d
> char1  is a char
> int1  is a struct
> foovar1  is a struct
> byte1  is a struct
> ````
>
> Looks like there isn't a problem? Or at least, it's now fixed 
> in git master.
>
> Which exact version of dmd are you using?  Did you download 
> from dlang.org or did you build your own?
>
>
> --T

Probably I misunderstand, but to me:
```
int1  is a struct
```
and

```
byte1  is a struct
```
are both errors.

The 'struct' test is being triggered for things that are not 
structs.


More information about the Digitalmars-d-learn mailing list