Ensure that function parameter's type is not void (#2118)

Fixes #2094
diff --git a/source/val/validate_type.cpp b/source/val/validate_type.cpp
index 651f2bf..3bbdb87 100644
--- a/source/val/validate_type.cpp
+++ b/source/val/validate_type.cpp
@@ -266,6 +266,12 @@
              << "OpTypeFunction Parameter Type <id> '" << _.getIdName(param_id)
              << "' is not a type.";
     }
+
+    if (param_type->opcode() == SpvOpTypeVoid) {
+      return _.diag(SPV_ERROR_INVALID_ID, inst)
+             << "OpTypeFunction Parameter Type <id> '" << _.getIdName(param_id)
+             << "' cannot be OpTypeVoid.";
+    }
   }
   const uint32_t num_function_args_limit =
       _.options()->universal_limits_.max_function_args;
diff --git a/test/val/val_id_test.cpp b/test/val/val_id_test.cpp
index 5a61040..21b41e5 100644
--- a/test/val/val_id_test.cpp
+++ b/test/val/val_id_test.cpp
@@ -979,6 +979,18 @@
       HasSubstr("OpTypeFunction Parameter Type <id> '3' is not a type."));
 }
 
+TEST_F(ValidateIdWithMessage, OpTypeFunctionParameterTypeVoidBad) {
+  std::string spirv = kGLSL450MemoryModel + R"(
+%1 = OpTypeVoid
+%2 = OpTypeInt 32 0
+%4 = OpTypeFunction %1 %2 %1)";
+  CompileSuccessfully(spirv.c_str());
+  EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions());
+  EXPECT_THAT(getDiagnosticString(),
+              HasSubstr("OpTypeFunction Parameter Type <id> '1' cannot be "
+                        "OpTypeVoid."));
+}
+
 TEST_F(ValidateIdWithMessage, OpTypePipeGood) {
   std::string spirv = kGLSL450MemoryModel + R"(
 %1 = OpTypeFloat 32