title: Differentiate String Literal from Char Array
body: <p>I want to write some function that takes a string literal - and <strong>only</strong> a string literal:</p>
  
  <pre><code>template &lt;size_t N&gt;
  void foo(const char (&amp;str)[N]);
  </code></pre>
  
  <p>Unfortunately, that is too expansive and will match any array of <code>char</code> - whether or not it's a true string literal. While it's impossible to tell the difference between these at compile-time - <strong>without</strong> having to resort to requiring the <em>caller</em> to wrap the literal/array - at run-time, the two arrays will be in entirely different places in memory:</p>
  
  <pre><code>foo("Hello"); // at 0x400f81
  
  const char msg[] = {'1', '2', '3'};
  foo(msg); // at 0x7fff3552767f
  </code></pre>
  
  <p>Is there a way to know where in memory the string data could live so that I could at least <code>assert</code> that the function takes a string literal only? (Using gcc 4.7.3, but really a solution for any compiler would be great).</p>