diff --git a/ctx.cpp b/ctx.cpp index 896f9346..0554485f 100644 --- a/ctx.cpp +++ b/ctx.cpp @@ -3243,7 +3243,8 @@ FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType, // Now, do a masked store into the memory allocated to // accumulate the result using the call mask. - if (callResult != NULL) { + if (callResult != NULL && + callResult->getType() != LLVMTypes::VoidType) { Assert(resultPtr != NULL); StoreInst(callResult, resultPtr, callMask, returnType, PointerType::GetUniform(returnType)); diff --git a/expr.cpp b/expr.cpp index 4dac53ee..e5d0050c 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3586,11 +3586,15 @@ FunctionCallExpr::TypeCheck() { Assert(funcType->GetParameterDefault(i) != NULL); } - if (fptrType->IsVaryingType() && - funcType->GetReturnType()->IsUniformType()) { - Error(pos, "Illegal to call a varying function pointer that " - "points to a function with a uniform return type."); - return NULL; + if (fptrType->IsVaryingType()) { + const Type *retType = funcType->GetReturnType(); + if (Type::Equal(retType, AtomicType::Void) == false && + retType->IsUniformType()) { + Error(pos, "Illegal to call a varying function pointer that " + "points to a function with a uniform return type \"%s\".", + funcType->GetReturnType()->GetString().c_str()); + return NULL; + } } }