summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckDeclarator.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-03-23 12:29:08 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2010-03-23 12:29:08 +0100
commit071f8ae3b52de2f67a7a6830330fe6eac47df551 (patch)
treeb64b31776c7a6d4b4a19bd5b2c7cf7c09ab5aa23 /src/shared/cplusplus/CheckDeclarator.cpp
parent8141f496ffee4d70b3563e2a3b091b1826a7859f (diff)
downloadqt-creator-071f8ae3b52de2f67a7a6830330fe6eac47df551.tar.gz
Warn for invalid pointer to references.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclarator.cpp')
-rw-r--r--src/shared/cplusplus/CheckDeclarator.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp
index 44aaf32a0b..5b19b6cb53 100644
--- a/src/shared/cplusplus/CheckDeclarator.cpp
+++ b/src/shared/cplusplus/CheckDeclarator.cpp
@@ -230,6 +230,9 @@ bool CheckDeclarator::visit(PointerToMemberAST *ast)
bool CheckDeclarator::visit(PointerAST *ast)
{
+ if (_fullySpecifiedType->isReferenceType())
+ translationUnit()->error(ast->firstToken(), "cannot declare pointer to a reference");
+
PointerType *ptrTy = control()->pointerType(_fullySpecifiedType);
FullySpecifiedType ty(ptrTy);
_fullySpecifiedType = ty;