Fix bug with taking references of temporaries.
Previously, the compiler would crash if e.g. the program passed a temporary value to a function taking a const reference. This change fixes ReferenceExpr::GetValue() to handle this case and allocate temporary storage for the temporary so that the pointer to that storage can be used for the reference value.
This commit is contained in:
14
tests/ref-as-temporary.ispc
Normal file
14
tests/ref-as-temporary.ispc
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
int func(const int &a) { return a+1; }
|
||||
int bar() { return 0; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
RET[programIndex] = func(bar());
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user