summaryrefslogtreecommitdiff
path: root/tests/generics
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-05-10 12:54:15 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-05-10 13:02:03 +0200
commitbb3c713152f6b48f87806a8aeccbb9add69ec0bf (patch)
tree88697905695d166d51b69bec826230fd4faa755f /tests/generics
parent2ae1698832e81a0ca46da91d882373c93b4ae0e0 (diff)
downloadvala-bb3c713152f6b48f87806a8aeccbb9add69ec0bf.tar.gz
vala: Transform cast from integer-type to boxed-type
Don't generate faulty c-code with results in segmentation faults. Fixes https://gitlab.gnome.org/GNOME/vala/issues/992
Diffstat (limited to 'tests/generics')
-rw-r--r--tests/generics/integer-type-cast.vala9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/generics/integer-type-cast.vala b/tests/generics/integer-type-cast.vala
new file mode 100644
index 000000000..4d7ea8ba6
--- /dev/null
+++ b/tests/generics/integer-type-cast.vala
@@ -0,0 +1,9 @@
+void foo<G,T> (G g, T t) {
+ assert ((int64?) g == int64.MIN);
+ assert ((uint64?) t == uint64.MAX);
+}
+
+void main () {
+ foo ((int64?) int64.MIN, (uint64?) uint64.MAX);
+ foo<int64?,uint64?> ((int64?) int64.MIN, (uint64?) uint64.MAX);
+}