diff --git a/alib2cli/src/ast/command/PrintCommand.h b/alib2cli/src/ast/command/PrintCommand.h index 3266f095af8f9822e744b36ef5d66435b63fe6df..d2c3350f0067a35104284833708fc65fbaca18d8 100644 --- a/alib2cli/src/ast/command/PrintCommand.h +++ b/alib2cli/src/ast/command/PrintCommand.h @@ -20,6 +20,9 @@ public: CommandResult run ( Environment & environment ) const override { std::shared_ptr < abstraction::Value > value = m_expr->translateAndEval ( environment ); + if ( value->getType ( ) == std::string ( ext::to_string < void > ( ) ) ) + throw std::invalid_argument ( "Printing void is not allowed." ); + std::shared_ptr < abstraction::OperationAbstraction > res = abstraction::Registry::getValuePrinterAbstraction ( value->getType ( ) ); res->attachInput ( value, 0 );