DescriptionOrdinarily, it's fine to have type coercion on function parameters, for example, if you pass a float where a color was expected, it'll just do the usual float-to-color conversion into a temporary before using it as an argument.
But this is wrong if it's an output parameter -- because if the function *writes* to that coerced temporary, well, how the heck is the result supposed to get back to the original argument, which can't even hold a color?
So this proposed change catches this error and prints as clear an error message as I could muster:
{{{
test.osl:11: error: Cannot pass 'float f' as argument 2 to myfunc
because it is an output parameter that must be a color
}}}
This is related to this issue: http://code.google.com/p/openshadinglanguage/issues/detail?id=51
Patch Set 1 #
MessagesTotal messages: 2
|