cgen: fix optional struct declarations for empty structs (#13970)
							parent
							
								
									45a427e68b
								
							
						
					
					
						commit
						617608b23d
					
				| 
						 | 
				
			
			@ -1,9 +1,7 @@
 | 
			
		|||
import json
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
struct DbConfig {
 | 
			
		||||
	foo int
 | 
			
		||||
}
 | 
			
		||||
struct DbConfig {}
 | 
			
		||||
 | 
			
		||||
fn test_json_decode_with_optional_arg() {
 | 
			
		||||
	if ret := print_info() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -972,7 +972,7 @@ fn (g Gen) optional_type_text(styp string, base string) string {
 | 
			
		|||
	ret := 'struct $styp {
 | 
			
		||||
	byte state;
 | 
			
		||||
	IError err;
 | 
			
		||||
	byte data[sizeof($size)];
 | 
			
		||||
	byte data[sizeof($size) > 0 ? sizeof($size) : 1];
 | 
			
		||||
}'
 | 
			
		||||
	return ret
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue