title: Is it possible to initialise a character array with a conditionally selected string literal?
body: <p>I know it's perfectly possible to initialise a <code>char</code> array with a string literal:</p>
  
  <pre><code>char arr[] = "foo";
  </code></pre>
  
  <p>C++11 8.5.2/1 says so:</p>
  
  <blockquote>
    <p>A <code>char</code> array (whether plain <code>char</code>, <code>signed char</code>, or <code>unsigned char</code>), <code>char16_t</code> array, <code>char32_t</code> array, or
    <code>wchar_t</code> array can be initialized by a narrow character literal, <code>char16_t</code> string literal, <code>char32_t</code> string
    literal, or wide string literal, respectively, or by an appropriately-typed string literal enclosed in braces.
    Successive characters of the value of the string literal initialize the elements of the array. ...</p>
  </blockquote>
  
  <p>However, can you do the same with <em>two</em> string literals in a conditional expression? For example like this:</p>
  
  <pre><code>char arr[] = MY_BOOLEAN_MACRO() ? "foo" : "bar";
  </code></pre>
  
  <p>(Where <code>MY_BOOLEAN_MACRO()</code> expands to a <code>1</code> or <code>0</code>).</p>
  
  <p>The relevant parts of C++11 5.16 (Conditional operator) are as follows:</p>
  
  <blockquote>
    <p>1 ... The first expression is contextually converted to <code>bool</code> (Clause 4).
    It is evaluated and if it is <code>true</code>, the result of the conditional expression is the value of the second expression,
    otherwise that of the third expression. ...</p>
    
    <p>4 If the second and third operands are glvalues of the same value category and have the same type, the result
    is of that type and value category and it is a bit-field if the second or the third operand is a bit-field, or if
    both are bit-fields.</p>
  </blockquote>
  
  <p>Notice that the literals are of the same length and thus they're both lvalues of type <code>const char[4]</code>.</p>
  
  <p><a href="http://ideone.com/eih2Jm">GCC one ideone</a> accepts the construct. But from reading the standard, I am simply not sure whether it's legal or not. Does anyone have better insight?</p>