Don't allow returning a struct containing an array in ESSL 1.00

ESSL 1.00.17 section 6.1 forbids this. Returning arrays was already
covered by the checks that disallow declaring array types in ESSL
1.00.

BUG=angleproject:1015
TEST=dEQP-GLES2.functional.shaders.functions.* (2 new tests pass)
     dEQP-GLES3.functional.shaders.functions.* (no regression)

Change-Id: Iaffa1631c0c940afb57819221e7e8603b2305021
Reviewed-on: https://chromium-review.googlesource.com/352920
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index db9aa05..9e836d1 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2198,6 +2198,20 @@
     {
         recover();
     }
+    if (mShaderVersion < 300)
+    {
+        // Array return values are forbidden, but there's also no valid syntax for declaring array
+        // return values in ESSL 1.00.
+        ASSERT(type.arraySize == 0 || mDiagnostics.numErrors() > 0);
+
+        if (type.isStructureContainingArrays())
+        {
+            // ESSL 1.00.17 section 6.1 Function Definitions
+            error(location, "structures containing arrays can't be function return values",
+                  TType(type).getCompleteString().c_str());
+            recover();
+        }
+    }
 
     // Add the function as a prototype after parsing it (we do not support recursion)
     return new TFunction(name, new TType(type));