Fix over-aggressive check in DereferenceExpr::TypeCheck()
(Reference types are allowed as well.)
This commit is contained in:
7
expr.cpp
7
expr.cpp
@@ -6325,9 +6325,10 @@ DereferenceExpr::TypeCheck() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dynamic_cast<const PointerType *>(expr->GetType()) == NULL) {
|
||||
Error(pos, "Illegal to dereference non-pointer type \"%s\".",
|
||||
expr->GetType()->GetString().c_str());
|
||||
if (dynamic_cast<const PointerType *>(expr->GetType()) == NULL &&
|
||||
dynamic_cast<const ReferenceType *>(expr->GetType()) == NULL) {
|
||||
Error(pos, "Illegal to dereference non-pointer or reference "
|
||||
"type \"%s\".", expr->GetType()->GetString().c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user