translator: Fix ASSERT in array init corner case.
This ASSERT was benign and can be turned into an error check. The
pattern in question is to initialize an array with another array
as the first argument, but dereferencing the array with "." instead
of "[]". This would trip up our error handling.
BUG=chromium:662702
Change-Id: Ie0e44af7b9d1a66cad03cefae9bf931f8e216cd9
Reviewed-on: https://chromium-review.googlesource.com/437599
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 52e7669..d807ea8 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -686,8 +686,12 @@
for (TIntermNode *const &argNode : *arguments)
{
const TType &argType = argNode->getAsTyped()->getType();
- // It has already been checked that the argument is not an array.
- ASSERT(!argType.isArray());
+ // It has already been checked that the argument is not an array, but we can arrive
+ // here due to prior error conditions.
+ if (argType.isArray())
+ {
+ return false;
+ }
if (!argType.sameElementType(type))
{
error(line, "Array constructor argument has an incorrect type", "constructor");