summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckDeclarator.cpp
diff options
context:
space:
mode:
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;