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

@@ -2426,7 +2426,7 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) {
return NULL;
if (dynamic_cast<const ReferenceType *>(type) != NULL) {
expr = new DereferenceExpr(expr, expr->pos);
expr = new RefDerefExpr(expr, expr->pos);
type = expr->GetType();
if (type == NULL)
return NULL;