From 550ad700c377e90f53c8fb976601d780e09407df Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 18 Apr 2011 03:26:46 +0000 Subject: [PATCH] compiler: allow class declarations inside records (1 part of issue #0019099) git-svn-id: trunk@17335 - --- .gitattributes | 1 + compiler/pdecobj.pas | 2 +- tests/test/terecs11.pp | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/test/terecs11.pp diff --git a/.gitattributes b/.gitattributes index 23d8234e35..66bc2d8e67 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/pdecobj.pas b/compiler/pdecobj.pas index 763aa165fe..911a58880e 100644 --- a/compiler/pdecobj.pas +++ b/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); diff --git a/tests/test/terecs11.pp b/tests/test/terecs11.pp new file mode 100644 index 0000000000..58f975f1a7 --- /dev/null +++ b/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. +