Merge pull request #963 from guanqun/disallow-void-var

Disallow implicit declaration of void type.
This commit is contained in:
chriseth 2015-02-06 12:08:24 +01:00
commit 16fc2d651e

View File

@ -383,6 +383,8 @@ void VariableDefinition::checkTypeRequirements()
BOOST_THROW_EXCEPTION(m_value->createTypeError("Invalid integer constant " + type->toString())); BOOST_THROW_EXCEPTION(m_value->createTypeError("Invalid integer constant " + type->toString()));
type = intType; type = intType;
} }
else if (type->getCategory() == Type::Category::VOID)
BOOST_THROW_EXCEPTION(m_variable->createTypeError("var cannot be void type"));
m_variable->setType(type); m_variable->setType(type);
} }
} }