Fix issue #693. Ternary operator on void type.

This commit is contained in:
John Kessenich 2017-01-26 15:48:27 -07:00
parent c0904c15c2
commit 82e0e58993
4 changed files with 32 additions and 3 deletions

View file

@ -1232,7 +1232,7 @@ TIntermAggregate* TIntermediate::makeAggregate(const TSourceLoc& loc)
//
// Returns the selection node created.
//
TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc)
TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc)
{
//
// Don't prune the false path for compile-time constants; it's needed
@ -1281,6 +1281,12 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type,
//
TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& loc)
{
// If it's void, go to the if-then-else selection()
if (trueBlock->getBasicType() == EbtVoid && falseBlock->getBasicType() == EbtVoid) {
TIntermNodePair pair = { trueBlock, falseBlock };
return addSelection(cond, pair, loc);
}
//
// Get compatible types.
//