Browse Source

volatile: allow for assignments

Jonas Maebe 2 years ago
parent
commit
13346a42bc
2 changed files with 8 additions and 1 deletions
  1. 1 1
      compiler/htypechk.pas
  2. 7 0
      tests/tbs/tb0706.pp

+ 1 - 1
compiler/htypechk.pas

@@ -1869,7 +1869,7 @@ implementation
                begin
                  if ((valid_const in opts) and
                      (tinlinenode(hp).inlinenumber in [in_typeof_x])) or
-                    (tinlinenode(hp).inlinenumber in [in_unaligned_x,in_aligned_x]) then
+                    (tinlinenode(hp).inlinenumber in [in_unaligned_x,in_aligned_x,in_volatile_x]) then
                    result:=true
                  else
                    if report_errors then

+ 7 - 0
tests/tbs/tb0706.pp

@@ -0,0 +1,7 @@
+{ %norun }
+
+var
+  l: longint;
+begin
+  volatile(l) := 1;
+end.