Front-ends GLSL/HLSL: Fix initializer lists for structs of one member.

Single member structs initialized with an initializer list had
an incorrect argument for constructor emulation.
This commit is contained in:
John Kessenich
2016-07-29 18:22:22 -06:00
parent 96e9f47cbb
commit ff13213547
8 changed files with 567 additions and 331 deletions

View File

@@ -3725,8 +3725,14 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
return nullptr;
}
// now that the subtree is processed, process this node
return addConstructor(loc, initList, type);
// Now that the subtree is processed, process this node as if the
// initializer list is a set of arguments to a constructor.
TIntermNode* emulatedConstructorArguments;
if (initList->getSequence().size() == 1)
emulatedConstructorArguments = initList->getSequence()[0];
else
emulatedConstructorArguments = initList;
return addConstructor(loc, emulatedConstructorArguments, type);
}
//