diff --git a/Test/120.vert b/Test/120.vert index b1f69480..752318c7 100644 --- a/Test/120.vert +++ b/Test/120.vert @@ -72,6 +72,9 @@ vec3 overloadE(float[2]); vec3 overloadE(mat2 m); vec3 overloadE(vec2 v); +vec3 overloadF(int); +vec3 overloadF(float); + void foo() { float f; @@ -81,6 +84,7 @@ void foo() overloadB(f, 2); overloadB(1, i); + overloadC(1); // ERROR overloadC(1, i); overloadC(vec2(1), vec2(2)); overloadC(f, 3.0); // ERROR, no way @@ -109,4 +113,7 @@ void foo() float b[2]; overloadE(b); + + overloadF(1, 1); // ERROR + overloadF(1); } diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index c46b7e4d..a9fc2e2d 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2596,8 +2596,13 @@ const TFunction* TParseContext::findFunction120(TSourceLoc loc, const TFunction& int numPossibleMatches = 0; for (TVector::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) { - bool possibleMatch = true; const TFunction& function = *(*it); + + // to even be a potential match, number of arguments has to match + if (call.getParamCount() != function.getParamCount()) + continue; + + bool possibleMatch = true; for (int i = 0; i < function.getParamCount(); ++i) { // same types is easy if (*function[i].type == *call[i].type)