mirror of
https://github.com/RPCS3/glslang.git
synced 2025-02-15 00:17:27 +00:00
Fix parameter count bug in ambiguity checking for overloaded function matching under implicit conversions.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23827 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
0d22e31c75
commit
83a6b1edfc
@ -72,6 +72,9 @@ vec3 overloadE(float[2]);
|
|||||||
vec3 overloadE(mat2 m);
|
vec3 overloadE(mat2 m);
|
||||||
vec3 overloadE(vec2 v);
|
vec3 overloadE(vec2 v);
|
||||||
|
|
||||||
|
vec3 overloadF(int);
|
||||||
|
vec3 overloadF(float);
|
||||||
|
|
||||||
void foo()
|
void foo()
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
@ -81,6 +84,7 @@ void foo()
|
|||||||
overloadB(f, 2);
|
overloadB(f, 2);
|
||||||
overloadB(1, i);
|
overloadB(1, i);
|
||||||
|
|
||||||
|
overloadC(1); // ERROR
|
||||||
overloadC(1, i);
|
overloadC(1, i);
|
||||||
overloadC(vec2(1), vec2(2));
|
overloadC(vec2(1), vec2(2));
|
||||||
overloadC(f, 3.0); // ERROR, no way
|
overloadC(f, 3.0); // ERROR, no way
|
||||||
@ -109,4 +113,7 @@ void foo()
|
|||||||
|
|
||||||
float b[2];
|
float b[2];
|
||||||
overloadE(b);
|
overloadE(b);
|
||||||
|
|
||||||
|
overloadF(1, 1); // ERROR
|
||||||
|
overloadF(1);
|
||||||
}
|
}
|
||||||
|
@ -2596,8 +2596,13 @@ const TFunction* TParseContext::findFunction120(TSourceLoc loc, const TFunction&
|
|||||||
|
|
||||||
int numPossibleMatches = 0;
|
int numPossibleMatches = 0;
|
||||||
for (TVector<TFunction*>::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) {
|
for (TVector<TFunction*>::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) {
|
||||||
bool possibleMatch = true;
|
|
||||||
const TFunction& function = *(*it);
|
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) {
|
for (int i = 0; i < function.getParamCount(); ++i) {
|
||||||
// same types is easy
|
// same types is easy
|
||||||
if (*function[i].type == *call[i].type)
|
if (*function[i].type == *call[i].type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user