mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 10:11:27 +01:00 
			
		
		
		
	compiler: don't allow record case with parameterized members
git-svn-id: trunk@16682 -
This commit is contained in:
		
							parent
							
								
									55a0fefb1f
								
							
						
					
					
						commit
						79813da090
					
				
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -9414,6 +9414,7 @@ tests/test/tgeneric22.pp svneol=native#text/pascal | |||||||
| tests/test/tgeneric23.pp svneol=native#text/pascal | tests/test/tgeneric23.pp svneol=native#text/pascal | ||||||
| tests/test/tgeneric24.pp svneol=native#text/pascal | tests/test/tgeneric24.pp svneol=native#text/pascal | ||||||
| tests/test/tgeneric25.pp svneol=native#text/pascal | tests/test/tgeneric25.pp svneol=native#text/pascal | ||||||
|  | tests/test/tgeneric26.pp svneol=native#text/pascal | ||||||
| tests/test/tgeneric3.pp svneol=native#text/plain | tests/test/tgeneric3.pp svneol=native#text/plain | ||||||
| tests/test/tgeneric4.pp svneol=native#text/plain | tests/test/tgeneric4.pp svneol=native#text/plain | ||||||
| tests/test/tgeneric5.pp svneol=native#text/plain | tests/test/tgeneric5.pp svneol=native#text/plain | ||||||
|  | |||||||
| @ -368,7 +368,7 @@ scanner_w_illegal_warn_identifier=02087_W_Illegal identifier "$1" for $WARN dire | |||||||
| # | # | ||||||
| # Parser | # Parser | ||||||
| # | # | ||||||
| # 03303 is the last used one | # 03304 is the last used one | ||||||
| # | # | ||||||
| % \section{Parser messages} | % \section{Parser messages} | ||||||
| % This section lists all parser messages. The parser takes care of the | % This section lists all parser messages. The parser takes care of the | ||||||
| @ -1363,6 +1363,9 @@ parser_e_no_constructor_in_records=03302_E_Constructors aren't allowed in record | |||||||
| parser_e_at_least_one_argument_must_be_of_type=03303_E_At least one argument must be of type "$1" | parser_e_at_least_one_argument_must_be_of_type=03303_E_At least one argument must be of type "$1" | ||||||
| % It is required that at least one argument be of type of structure where this method is defined. | % It is required that at least one argument be of type of structure where this method is defined. | ||||||
| % For example class operators must contain at least one argument of the structure where they are defined. | % For example class operators must contain at least one argument of the structure where they are defined. | ||||||
|  | parser_e_cant_use_type_parameters_here=03304_E_Type parameters may require initialization/finalization - can't be used in variant records | ||||||
|  | % Type parameters may be specialized with types which (e.g. \var{ansistring}) need initialization/finalization | ||||||
|  | % code which is implicitly generated by the compiler.  | ||||||
| # | # | ||||||
| # Type Checking | # Type Checking | ||||||
| # | # | ||||||
|  | |||||||
| @ -392,6 +392,7 @@ const | |||||||
|   parser_e_class_methods_only_static_in_records=03301; |   parser_e_class_methods_only_static_in_records=03301; | ||||||
|   parser_e_no_constructor_in_records=03302; |   parser_e_no_constructor_in_records=03302; | ||||||
|   parser_e_at_least_one_argument_must_be_of_type=03303; |   parser_e_at_least_one_argument_must_be_of_type=03303; | ||||||
|  |   parser_e_cant_use_type_parameters_here=03304; | ||||||
|   type_e_mismatch=04000; |   type_e_mismatch=04000; | ||||||
|   type_e_incompatible_types=04001; |   type_e_incompatible_types=04001; | ||||||
|   type_e_not_equal_types=04002; |   type_e_not_equal_types=04002; | ||||||
| @ -877,9 +878,9 @@ const | |||||||
|   option_info=11024; |   option_info=11024; | ||||||
|   option_help_pages=11025; |   option_help_pages=11025; | ||||||
| 
 | 
 | ||||||
|   MsgTxtSize = 58278; |   MsgTxtSize = 58377; | ||||||
| 
 | 
 | ||||||
|   MsgIdxMax : array[1..20] of longint=( |   MsgIdxMax : array[1..20] of longint=( | ||||||
|     24,88,304,97,82,54,111,22,202,63, |     24,88,305,97,82,54,111,22,202,63, | ||||||
|     49,20,1,1,1,1,1,1,1,1 |     49,20,1,1,1,1,1,1,1,1 | ||||||
|   ); |   ); | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1492,9 +1492,12 @@ implementation | |||||||
| 
 | 
 | ||||||
|              { types that use init/final are not allowed in variant parts, but |              { types that use init/final are not allowed in variant parts, but | ||||||
|                classes are allowed } |                classes are allowed } | ||||||
|              if (variantrecordlevel>0) and |              if (variantrecordlevel>0) then | ||||||
|                 is_managed_type(hdef) then |                if is_managed_type(hdef) then | ||||||
|                Message(parser_e_cant_use_inittable_here); |                  Message(parser_e_cant_use_inittable_here) | ||||||
|  |                else | ||||||
|  |                if hdef.typ=undefineddef then | ||||||
|  |                  Message(parser_e_cant_use_type_parameters_here); | ||||||
| 
 | 
 | ||||||
|              { try to parse the hint directives } |              { try to parse the hint directives } | ||||||
|              hintsymoptions:=[]; |              hintsymoptions:=[]; | ||||||
|  | |||||||
							
								
								
									
										15
									
								
								tests/test/tgeneric26.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/test/tgeneric26.pp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | { %fail } | ||||||
|  | program tgeneric26; | ||||||
|  | 
 | ||||||
|  | {$mode objfpc}{$H+} | ||||||
|  | type | ||||||
|  |   generic TRecArr<T> = array[0..1] of record | ||||||
|  |     case enum:(one, two, three) of | ||||||
|  |       one: (F: T); // can't use type parameter here | ||||||
|  |       two: (Z: T); | ||||||
|  |       three: (Y: T); | ||||||
|  |   end; | ||||||
|  | 
 | ||||||
|  | begin | ||||||
|  | end. | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 paul
						paul