diff python/testc3.py @ 221:848c4b15fd0b

pointers
author Windel Bouwman
date Mon, 08 Jul 2013 22:21:44 +0200
parents 3f6c30a5d234
children 1c7364bd74c7
line wrap: on
line diff
--- a/python/testc3.py	Sat Jul 06 21:32:20 2013 +0200
+++ b/python/testc3.py	Mon Jul 08 22:21:44 2013 +0200
@@ -212,13 +212,28 @@
          var int* pa;
          function void t(int a, double b)
          {
-            pa = 2;
             pa = &a;
             *pa = 22;
          }
         """
         self.expectOK(snippet)
 
+    def testPointerTypeInCorrect(self):
+        snippet = """
+         package testpointerincorrect;
+         var int* pa;
+         function void t(int a, double b)
+         {
+            pa = 2; // type conflict
+            pa = &a;
+            pa = &2;
+            &a = 3; // no valid lvalue and incorrect types.
+            &a = pa; // No valid lvalue
+            **pa = 22; // Cannot deref int
+         }
+        """
+        self.expectErrors(snippet, [6, 9, 9, 10, 11])
+
     @unittest.skip 
     def testComplexType(self):
         snippet = """