ref: aedfbe887c3e0e2a2b8f5f9fa546c1f792e0483c
parent: 0c67d98527f61a1ccef4b082d484c82b58876b80
author: Ori Bernstein <[email protected]>
date: Tue Aug 19 13:06:58 EDT 2014
Fix pointer comparisons, and add a test for it.
--- a/parse/type.c
+++ b/parse/type.c
@@ -275,6 +275,7 @@
switch (tybase(t)->type) {
case Tybyte: case Tyuint8: case Tyuint16: case Tyuint:
case Tychar: case Tyuint32: case Tyuint64: case Tyulong:
+ case Typtr:
return 1;
default:
return 0;
--- /dev/null
+++ b/test/ptrcmp.myr
@@ -1,0 +1,13 @@
+use std
+
+const main = {
+ var a, b, v1, v2
+
+ v1 = 42
+ v2 = 42
+ a = &v1
+ b = &v1
+ std.assert(a == b, "pointers should be equal, but weren't\n")
+ std.assert(a != b, "pointers weren't equal, but should be\n")
+ std.exit(0)
+}
--- a/test/tests
+++ b/test/tests
@@ -65,6 +65,7 @@
B condiftrue E 7
B condiffalse E 9
B condifrel E 7
+B ptrcmp E 0
B overlappingif E 2
#B bigcondarg C ## BUGGERED
B fib E 21