disallow declaration of void type

https://www.pivotaltracker.com/n/projects/1189488/stories/86318578
This commit is contained in:
Lu Guanqun 2015-02-06 07:44:38 +08:00
parent e86c4602c5
commit 7267afff55

View File

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