mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix optional struct declarations for empty structs (#13970)
This commit is contained in:
parent
45a427e68b
commit
617608b23d
@ -1,9 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
struct DbConfig {
|
struct DbConfig {}
|
||||||
foo int
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test_json_decode_with_optional_arg() {
|
fn test_json_decode_with_optional_arg() {
|
||||||
if ret := print_info() {
|
if ret := print_info() {
|
||||||
|
@ -972,7 +972,7 @@ fn (g Gen) optional_type_text(styp string, base string) string {
|
|||||||
ret := 'struct $styp {
|
ret := 'struct $styp {
|
||||||
byte state;
|
byte state;
|
||||||
IError err;
|
IError err;
|
||||||
byte data[sizeof($size)];
|
byte data[sizeof($size) > 0 ? sizeof($size) : 1];
|
||||||
}'
|
}'
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user