From 7267afff55957b6c8ef113a85e20474c923f795c Mon Sep 17 00:00:00 2001 From: Lu Guanqun Date: Fri, 6 Feb 2015 07:44:38 +0800 Subject: [PATCH] disallow declaration of void type https://www.pivotaltracker.com/n/projects/1189488/stories/86318578 --- AST.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AST.cpp b/AST.cpp index dfb677f7e..0ec0eb0cc 100644 --- a/AST.cpp +++ b/AST.cpp @@ -383,6 +383,8 @@ void VariableDefinition::checkTypeRequirements() BOOST_THROW_EXCEPTION(m_value->createTypeError("Invalid integer constant " + type->toString())); type = intType; } + else if (type->getCategory() == Type::Category::VOID) + BOOST_THROW_EXCEPTION(m_variable->createTypeError("var cannot be void type")); m_variable->setType(type); } }