glsl: Improve error message when attemping assignment to unsized array
authorTimothy Arceri <t_arceri@yahoo.com.au>
Tue, 19 Nov 2013 21:42:19 +0000 (08:42 +1100)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 23 Nov 2013 23:52:27 +0000 (15:52 -0800)
V2: Return after error to avoid cascading error messages and
removed redundant "to" from error message

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp

index 01280478c95714033beff01708c5b8f462afded6..43cf49745573a772d5d56d26ac6ac7b93fbf81a1 100644 (file)
@@ -696,9 +696,15 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
     * Note: Whole-array assignments are not permitted in GLSL 1.10, but this
     * is handled by ir_dereference::is_lvalue.
     */
-   if (is_initializer && lhs_type->is_unsized_array() && rhs->type->is_array()
+   if (lhs_type->is_unsized_array() && rhs->type->is_array()
        && (lhs_type->element_type() == rhs->type->element_type())) {
-      return rhs;
+      if (is_initializer) {
+         return rhs;
+      } else {
+         _mesa_glsl_error(&loc, state,
+                          "implicitly sized arrays cannot be assigned");
+         return NULL;
+      }
    }
 
    /* Check for implicit conversion in GLSL 1.20 */