title: Confusion with commas in ternary expression
body: <p>I found the following interesting code today:</p>
  
  <pre><code>SomeFunction(some_bool_variable ? 12.f, 50.f : 50.f, 12.f)
  </code></pre>
  
  <p>I created a small sample to reproduce the behavior:</p>
  
  <pre><code>class Vector3f
  {
  public:
      Vector3f(float val)
      {
          std::cout &lt;&lt; "vector constructor: " &lt;&lt; val &lt;&lt; '\n';
      }
  };
  
  void SetSize(Vector3f v)
  {
      std::cout &lt;&lt; "SetSize single param\n";
  }
  
  void SetSize(float w, float h, float d=0)
  {
      std::cout &lt;&lt; "SetSize multi param: " &lt;&lt; w &lt;&lt; ", " &lt;&lt; h &lt;&lt; ", " &lt;&lt; d &lt;&lt; '\n';
  }
  
  int main()
  {
      SetSize(true ? 12.f, 50.f : 50.f, 12.f);
      SetSize(false ? 12.f, 50.f : 50.f, 12.f);
  }
  </code></pre>
  
  <p>(<a href="http://coliru.stacked-crooked.com/a/6c2286c8ea8f996f" rel="noreferrer">Live Sample</a>)</p>
  
  <p>The result I get from running the above code is:</p>
  
  <pre class="lang-none prettyprint-override"><code>clang++ -std=c++14 -O2 -Wall -pedantic -lboost_system -lboost_filesystem -pthread main.cpp &amp;&amp; ./a.out
  main.cpp:29:20: warning: expression result unused [-Wunused-value]
      SetSize(true ? 12.f, 50.f : 50.f, 12.f);
                     ^~~~
  main.cpp:30:21: warning: expression result unused [-Wunused-value]
      SetSize(false ? 12.f, 50.f : 50.f, 12.f);
                      ^~~~
  2 warnings generated.
  SetSize multi param: 50, 12, 0
  SetSize multi param: 50, 12, 0
  </code></pre>
  
  <p>What I was expecting in <em>both</em> cases was that a single parameter would be passed to <code>SetSize(float)</code>. However, two parameters are passed which I find extremely confusing (especially since ternary has precedence over comma; so I assumed the comma was not delimiting function arguments in this case). For example, if using <code>true</code>, the ternary should result in <code>12.f, 50.f</code>. In this expression, the value to the left of the comma gets dropped/ignored, so I'd expect the end result to be:</p>
  
  <pre><code>SetSize(50.f);
  </code></pre>
  
  <p>The second part of the confusion is that whether we use <code>true</code> or <code>false</code> in the ternary, the same 2 values are passed to the function. The <code>true</code> case should be <code>h=12, w=50</code> I'd think...</p>
  
  <p>I see the compiler is trying to warn me about something, but I can't quite understand what's going on. Can someone decompose this logic and explain the result in a step by step fashion?</p>