Actually typecheck the arguments to functions called through function pointers.

(Somehow this wasn't being done before.)
Errors are now issued if too few arguments are used when calling through
a function pointer, too many arguments are used, or if any of them can't be
type converted to the parameter type.
This commit is contained in:
Matt Pharr
2011-12-14 12:22:49 -08:00
parent 89a5248f4f
commit 07f218137a
4 changed files with 92 additions and 23 deletions

View File

@@ -0,0 +1,9 @@
// Too many parameter values provided in function call
float bar(float a, float b);
export uniform int foo(uniform int x[], uniform int i[]) {
float (*fptr)(float, float) = bar;
//CO bar(0,1,2);
fptr(0., 1, 2);
}

View File

@@ -0,0 +1,9 @@
// Can't convert argument of type "void * const uniform" to type "float" for funcion call argument.
float bar(float a, float b);
export uniform int foo(uniform int x[], uniform int i[]) {
float (*fptr)(float, float) = bar;
//CO bar(0,1,2);
fptr(NULL, 1);
}

View File

@@ -0,0 +1,8 @@
// Too few parameter values provided in function call (1 provided, 2 expected).
float bar(float a, float b);
export uniform int foo(uniform int x[], uniform int i[]) {
float (*fptr)(float, float) = bar;
fptr(1.);
}