summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-03-23 12:27:09 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2010-03-23 12:27:09 +0100
commit8141f496ffee4d70b3563e2a3b091b1826a7859f (patch)
treef4c1bbbf4778be3761a41ce180e569ad60b19ca7
parenta2c4dee44f0a86b5cc303d84fb577eeffbe4ae09 (diff)
downloadqt-creator-8141f496ffee4d70b3563e2a3b091b1826a7859f.tar.gz
Warn for invalid references.
-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 86e3541d56..44aaf32a0b 100644
--- a/src/shared/cplusplus/CheckDeclarator.cpp
+++ b/src/shared/cplusplus/CheckDeclarator.cpp
@@ -241,6 +241,9 @@ bool CheckDeclarator::visit(ReferenceAST *ast)
{
const bool rvalueRef = (tokenKind(ast->reference_token) == T_AMPER_AMPER);
+ if (_fullySpecifiedType->isReferenceType())
+ translationUnit()->error(ast->firstToken(), "cannot declare reference to a reference");
+
ReferenceType *refTy = control()->referenceType(_fullySpecifiedType, rvalueRef);
FullySpecifiedType ty(refTy);
_fullySpecifiedType = ty;