Text vs String comparison : crash

Is it me or a bug ? (Xoxo 2015r2.2)

Simple code :

dim t as Text = "foo" dim s as String = "bar" dim v1 as Variant = t dim v2 as Variant = s if v1=v2 then end if

the line with the if statement (comparison) makes the app crash…

because TEXT and STRING are not the same datatype…
the compiler probably didn’t catch it because the compare was against variants

try casting them to the same datatype

[quote=192759:@Dave S]because TEXT and STRING are not the same datatype…
the compiler probably didn’t catch it because the compare was against variants

try casting them to the same datatype[/quote]

Comparing t to s directly does not crash. Could be something within Variant.

yes I am aware of that.
I catch this bug (I think this is one) accidentally while trying to understand why my app crashed.
the provided code is only to illustrate the issue.

I guess there is something wrong with the auto-conversions with variants.

I tried Auto/Auto, Auto/Variant and Variant/Auto : no crash.

It shouldn’t crash. Please file a bug report.

Done <https://xojo.com/issue/39650>