diff --git a/module.cpp b/module.cpp index 42843f6d..7b7f2e5c 100644 --- a/module.cpp +++ b/module.cpp @@ -343,8 +343,6 @@ Module::AddGlobalVariable(Symbol *sym, Expr *initExpr, bool isConst) { */ static bool lRecursiveCheckValidParamType(const Type *t) { - t = t->GetBaseType(); - const StructType *st = dynamic_cast(t); if (st != NULL) { for (int i = 0; i < st->GetElementCount(); ++i) @@ -352,15 +350,16 @@ lRecursiveCheckValidParamType(const Type *t) { return true; return false; } - else { - if (t->IsVaryingType()) - return true; - const PointerType *pt = dynamic_cast(t); - if (pt != NULL && pt->IsSlice()) - return true; - else - return false; - } + + const SequentialType *seqt = dynamic_cast(t); + if (seqt != NULL) + return lRecursiveCheckValidParamType(seqt->GetElementType()); + + const PointerType *pt = dynamic_cast(t); + if (pt != NULL) + return (pt->IsSlice() || pt->IsVaryingType()); + + return t->IsVaryingType(); }