Forbid enum redefinition.
Prevent the following code from compiling:
enum color {RED, GREEN, BLUE};
enum color {R, G, B};
int main()
{
        return R;
}
Reported-by: John Haque <j.eh@mchsi.com>
			
			
This commit is contained in:
		
							parent
							
								
									a465b7f58f
								
							
						
					
					
						commit
						0f522fb32a
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								tccgen.c
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								tccgen.c
									
										
									
									
									
								
							|  | @ -2801,6 +2801,7 @@ static void struct_decl(CType *type, int u) | ||||||
|                 if (tok == '}') |                 if (tok == '}') | ||||||
|                     break; |                     break; | ||||||
|             } |             } | ||||||
|  |             s->c = type_size(&int_type, &align); | ||||||
|             skip('}'); |             skip('}'); | ||||||
|         } else { |         } else { | ||||||
|             maxalign = 1; |             maxalign = 1; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue