Distinguish between dereferencing pointers and references.

We now have separate Expr implementations for dereferencing pointers
and automatically dereferencing references.  This is in particular
necessary so that we can detect attempts to dereference references
with the '*' operator in programs and issue an error in that case.

Fixes issue #192.
This commit is contained in:
Matt Pharr
2012-03-22 06:48:02 -07:00
parent 10c5ba140c
commit 20044f5749
7 changed files with 173 additions and 75 deletions

View File

@@ -1,4 +1,4 @@
// Illegal to dereference non-pointer or reference type "varying float"
// Illegal to dereference non-pointer type "varying float"
float func(float a) {
*a = 0;

View File

@@ -0,0 +1,10 @@
// Illegal to dereference non-pointer type "uniform float &".
export void simple_reduction(uniform float vin[], uniform int w, uniform float & result)
{
float sum = 0;
foreach (i = 0 ... w) {
sum += vin[i];
}
*result = reduce_add(sum); // << I would expect this to produce a compiler error
}