static if issue?
user1234
user1234 at 12.de
Thu Mar 12 14:05:17 UTC 2026
On Wednesday, 11 March 2026 at 15:28:51 UTC, H. S. Teoh wrote:
> On Wed, Mar 11, 2026 at 03:13:25PM +0000, DLearner via
> Digitalmars-d-learn wrote: [...]
>> ```
>> void main() {
>> int IntVar1 = 12;
>>
>> static if (is(typeof(IntVar1) != int)) {
>> static assert (false, "Type not int.");
>> } else {
>> }
>> }
>> ```
> [...]
>
> Write it this way instead:
>
> ```
> static if (!is(typeof(IntVar1) == int)) { ... }
> ```
>
>
> --T
Indeed but such an error should not be possible. The front-end
should be able to catch that and warn.
More information about the Digitalmars-d-learn
mailing list