diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp index 44aaf32a0bd986ac46d3cf5b0cfacf432de644b2..5b19b6cb5399ab84c894295f0e4510c176dd5610 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;