diff options
Diffstat (limited to 'src/lj_cconv.c')
-rw-r--r-- | src/lj_cconv.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/lj_cconv.c b/src/lj_cconv.c index ac6374ed..d4578f88 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c | |||
@@ -679,17 +679,12 @@ static void cconv_struct_init(CTState *cts, CType *d, CTSize sz, uint8_t *dp, | |||
679 | ** This is true if an aggregate is to be initialized with a value. | 679 | ** This is true if an aggregate is to be initialized with a value. |
680 | ** Valarrays are treated as values here so ct_tv handles (V|C, I|F). | 680 | ** Valarrays are treated as values here so ct_tv handles (V|C, I|F). |
681 | */ | 681 | */ |
682 | int lj_cconv_multi_init(CTState *cts, CType *d, TValue *o) | 682 | int lj_cconv_multi_init(CType *d, TValue *o) |
683 | { | 683 | { |
684 | if (!(ctype_isrefarray(d->info) || ctype_isstruct(d->info))) | 684 | if (!(ctype_isrefarray(d->info) || ctype_isstruct(d->info))) |
685 | return 0; /* Destination is not an aggregate. */ | 685 | return 0; /* Destination is not an aggregate. */ |
686 | if (tvistab(o) || (tvisstr(o) && !ctype_isstruct(d->info))) | 686 | if (tvistab(o) || (tvisstr(o) && !ctype_isstruct(d->info))) |
687 | return 0; /* Initializer is not a value. */ | 687 | return 0; /* Initializer is not a value. */ |
688 | if (tviscdata(o)) { | ||
689 | CTInfo info = lj_ctype_rawref(cts, cdataV(o)->typeid)->info; | ||
690 | if (ctype_isrefarray(info) || ctype_isstruct(info)) | ||
691 | return 0; /* Initializer is not a value. */ | ||
692 | } | ||
693 | return 1; /* Otherwise the initializer is a value. */ | 688 | return 1; /* Otherwise the initializer is a value. */ |
694 | } | 689 | } |
695 | 690 | ||
@@ -699,7 +694,7 @@ void lj_cconv_ct_init(CTState *cts, CType *d, CTSize sz, | |||
699 | { | 694 | { |
700 | if (len == 0) | 695 | if (len == 0) |
701 | memset(dp, 0, sz); | 696 | memset(dp, 0, sz); |
702 | else if (len == 1 && !lj_cconv_multi_init(cts, d, o)) | 697 | else if (len == 1 && !lj_cconv_multi_init(d, o)) |
703 | lj_cconv_ct_tv(cts, d, dp, o, 0); | 698 | lj_cconv_ct_tv(cts, d, dp, o, 0); |
704 | else if (ctype_isarray(d->info)) /* Also handles valarray init with len>1. */ | 699 | else if (ctype_isarray(d->info)) /* Also handles valarray init with len>1. */ |
705 | cconv_array_init(cts, d, sz, dp, o, len); | 700 | cconv_array_init(cts, d, sz, dp, o, len); |