summaryrefslogtreecommitdiffstats
path: root/ast_function.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-06-23 13:58:34 -0700
committerIan Romanick <[email protected]>2010-06-23 13:58:34 -0700
commitfa455fc2a529d26a0e03b9ff837a554c511cee71 (patch)
treebbe391c401a9be4eda1fb81b4eaa368494f5d8e6 /ast_function.cpp
parent3ed850e91c4aa4b520c1b7dd9c7e1eecd926bce7 (diff)
Generate errors for empty constructors instead of asserting
This causes the following tests to pass: glslparsertest/glsl2/constructor-10.vert
Diffstat (limited to 'ast_function.cpp')
-rw-r--r--ast_function.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/ast_function.cpp b/ast_function.cpp
index 691e6aeba00..ff2dfa502f3 100644
--- a/ast_function.cpp
+++ b/ast_function.cpp
@@ -513,7 +513,14 @@ ast_function_expression::hir(exec_list *instructions,
bool all_parameters_are_constant = true;
- assert(!this->expressions.is_empty());
+ /* This handles invalid constructor calls such as 'vec4 v = vec4();'
+ */
+ if (this->expressions.is_empty()) {
+ _mesa_glsl_error(& loc, state, "too few components to construct "
+ "`%s'",
+ constructor_type->name);
+ return ir_call::get_error_instruction();
+ }
foreach_list (n, &this->expressions) {
ast_node *ast = exec_node_data(ast_node, n, link);