title: g++ treats returned string literal as const char pointer not const char array
body: <p>I'm seeing some odd behaviour when returning a string literal from a function that should perform an implicit conversion with g++ (version 4.7.3).  Can anyone explain why the following code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  class Test
  {
  public:
    template &lt;unsigned int N&gt;
    Test(const char (&amp;foo)[N])
    {
      printf("Template const char array constructor\n");
    }
  
    Test(char* foo)
    {
      printf("char* constructor\n");
    }
  };
  
  Test fn()
  {
    return "foo";
  }
  
  int main()
  {
    Test t("bar");
    Test u = fn();
  
    return 0;
  }
  </code></pre>
  
  <p>produces the result:</p>
  
  <pre><code>Template const char array constructor
  char* constructor
  </code></pre>
  
  <p>on g++?  The surprising thing being that the char* constructor is chosen in preference to the const char array constructor when generating the return value from fn().  Admittedly there is a warning, "deprecated conversion from string constant to 'char*'"</p>
  
  <p>Even more surprisingly if you remove the char* constructor then the code doesn't compile with g++.</p>
  
  <p>It works as expected with clang (Template constructor used both times), which makes me think this is a compiler bug, but maybe it's just a weird corner of the C++ spec - could anyone confirm?</p>