title: Is it possible to pass a brace-enclosed initializer as a macro parameter?
body: <p>I have a function that I call like this:</p>
  
  <pre><code>literal&lt;long[2]&gt;({1, 2});
  </code></pre>
  
  <p>I want to write a macro that expands to this statement, e.g.:</p>
  
  <pre><code>MYMACRO(long[2], {1, 2})
  </code></pre>
  
  <p>Unfortunately, the preprocessor is not aware of brace-matching so it sees three arguments (the second and third are <code>{1</code> and <code>2}</code>, respectively).</p>
  
  <p>This is a known limitation of the preprocessor, and the simplest solution is often to add extra parentheses, if possible, in the macro invocation.</p>
  
  <p>But, in this case, placing the brace-enclosed initializer inside parentheses appears to change its meaning:</p>
  
  <pre><code>literal&lt;long[2]&gt;(({1, 2}));
  
  (g++ 4.8) error: left operand of comma operator has no effect [-Werror=unused-value]
  </code></pre>
  
  <p>Is this a GCC bug or correct by design?  Is there any way to accomplish what I want?</p>
  
  <h2>Update</h2>
  
  <p>I probably should have been more clear in the phrasing of the original questions.  The preprocessor hasn't changed in forever (even variadic macros have been a GCC extension for a long time).  The practical workarounds in this case are useful, but they're also very well known and not to the point I want to get at.</p>
  
  <p>I really want to know whether anything was added to C++11 to specifically address this issue (or was it an oversight?).  The quirky handling of braces in macro invocations seems like a much bigger issue now, given the greatly expanded use of brace-enclosed lists throughout the language.</p>
  
  <p>I'm especially annoyed by the fact that putting parentheses around a brace-enclosed initializer list changes the way it's parsed when used as a function parameter.  Is there any other parameter to a function invocation that cannot be parenthesized?  It seems like special-case hell when writing macros that pass parameters to functions.</p>
  
  <p>I'm really hoping somebody can point out that this is a GCC bug, or explain why putting parentheses around a brace-enclosed initializer list <strong>must</strong> change its meaning.</p>