Warn for invalid pointer to references.

This commit is contained in:
Roberto Raggi
2010-03-23 12:29:08 +01:00
parent 8141f496ff
commit 071f8ae3b5

View File

@@ -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;