Browse Source

compiler: allow class declarations inside records (1 part of issue #0019099)

git-svn-id: trunk@17335 -
paul 14 years ago
parent
commit
550ad700c3
3 changed files with 30 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pdecobj.pas
  3. 28 0
      tests/test/terecs11.pp

+ 1 - 0
.gitattributes

@@ -9695,6 +9695,7 @@ tests/test/tenum6.pp svneol=native#text/pascal
 tests/test/tenumerators1.pp svneol=native#text/pascal
 tests/test/terecs1.pp svneol=native#text/pascal
 tests/test/terecs10.pp svneol=native#text/pascal
+tests/test/terecs11.pp svneol=native#text/pascal
 tests/test/terecs2.pp svneol=native#text/pascal
 tests/test/terecs3.pp svneol=native#text/pascal
 tests/test/terecs4.pp svneol=native#text/pascal

+ 1 - 1
compiler/pdecobj.pas

@@ -1082,7 +1082,7 @@ implementation
         current_specializedef:=nil;
 
         { objects and class types can't be declared local }
-        if not(symtablestack.top.symtabletype in [globalsymtable,staticsymtable,objectsymtable]) and
+        if not(symtablestack.top.symtabletype in [globalsymtable,staticsymtable,objectsymtable,recordsymtable]) and
            not assigned(genericlist) then
           Message(parser_e_no_local_objects);
 

+ 28 - 0
tests/test/terecs11.pp

@@ -0,0 +1,28 @@
+program texrec1;
+
+{$ifdef fpc}
+  {$mode delphi}
+{$endif}
+
+type
+  TRecord = record
+  private type
+    TTestClass = class
+
+    end;
+    TTestRecord = record
+
+    end;
+    TTestObject = object
+
+    end;
+    TTestInterface = interface
+
+    end;
+    TTestString = String[20];
+    TTestRange = 0..42;
+  end;
+
+begin
+end.
+