Fix build on MSC
authorPyry Haulos <phaulos@google.com>
Wed, 9 Sep 2015 20:35:53 +0000 (13:35 -0700)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:54:39 +0000 (12:54 -0400)
Visual C++ compiler doesn't allow ternary select where type depends on
condition even if there is a user-defined conversion operator to a common
type.

source/binary.cpp

index 4ce371c..db1330d 100644 (file)
@@ -223,8 +223,11 @@ spv_result_t spvBinaryDecodeOperand(
     case SPV_OPERAND_TYPE_OPTIONAL_ID:
     case SPV_OPERAND_TYPE_ID_IN_OPTIONAL_TUPLE: {
       if (color) {
-        stream.get() << (type == SPV_OPERAND_TYPE_RESULT_ID ? clr::blue()
-                                                            : clr::yellow());
+        if (type == SPV_OPERAND_TYPE_RESULT_ID) {
+          stream.get() << clr::blue();
+        } else {
+          stream.get() << clr::yellow();
+        }
       }
       stream.get() << "%" << spvFixWord(words[index], endian);
       stream.get() << ((color) ? clr::reset() : "");