Browse Source

Fix for Mantis #25606.

pexpr.pas, postfixoperators:
  * try_type_helper: also allow type helpers for block type bt_const

+ added test

git-svn-id: trunk@29176 -
svenbarth 11 years ago
parent
commit
9611c3df52
3 changed files with 19 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pexpr.pas
  3. 17 0
      tests/webtbs/tw25606.pp

+ 1 - 0
.gitattributes

@@ -14058,6 +14058,7 @@ tests/webtbs/tw25600.pp svneol=native#text/pascal
 tests/webtbs/tw25603.pp svneol=native#text/pascal
 tests/webtbs/tw25604.pp svneol=native#text/pascal
 tests/webtbs/tw25605.pp svneol=native#text/pascal
+tests/webtbs/tw25606.pp svneol=native#text/pascal
 tests/webtbs/tw2561.pp svneol=native#text/plain
 tests/webtbs/tw25610.pp -text svneol=native#text/plain
 tests/webtbs/tw25685.pp svneol=native#text/pascal

+ 1 - 1
compiler/pexpr.pas

@@ -1716,7 +1716,7 @@ implementation
           extdef : tdef;
         begin
           result:=false;
-          if (token=_ID) and (block_type in [bt_body,bt_general,bt_except]) then
+          if (token=_ID) and (block_type in [bt_body,bt_general,bt_except,bt_const]) then
             begin
               if not assigned(def) then
                 if node.nodetype=addrn then

+ 17 - 0
tests/webtbs/tw25606.pp

@@ -0,0 +1,17 @@
+{ %NORUN }
+
+program tw25606;
+
+{$MODE DELPHI}
+
+type
+  TValueInt32Helper = record helper for Int32
+  const
+    C{: Int32} = 0;
+  end;
+
+var
+  I: Int32 = Int32.C;
+begin
+end.
+