title: Type of An Incomplete Array That Cannot Decay to Pointer
body: <p>The following code can be compiled and executed by <a href="http://coliru.stacked-crooked.com/a/749df05abfa5bc0d" rel="nofollow noreferrer" title="gcc">gcc</a>:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  template &lt;typename T&gt;
  T&amp;  f1(T &amp; t) {
    printf("T\n");
    return t;
  } 
  
  extern int a[];
  
  int main()
  {
      f1(a);
  
  
      return 0;
  }
  </code></pre>
  
  <p>But produced error when compiled by VC++2010:</p>
  
  <pre><code>1&gt;------ Build started: Project: cpptest, Configuration: Debug Win32 ------
  1&gt;  proc1.cpp
  1&gt;  cpptest.cpp
  1&gt;c:\work\cpptest\cpptest\cpptest.cpp(18): error C2664: 'f1' : cannot convert parameter 1 from 'int []' to 'int (&amp;)[1]'
  1&gt;  Generating Code...
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>The main issue is that the function template parameter is a reference type meaning the array argument cannot decay to a pointer type. What should be the standard behaviour according to C++03? If it is allowed, what should be the type of T, which is now an incomplete array type, inside the function <code>f1()</code> and its return type?</p>
  
  <p>EDIT: In C++ array passed-by-reference does not decay to a pointer according to this <a href="https://stackoverflow.com/questions/17752978/exception-to-array-not-decaying-into-a-pointer?noredirect=1&amp;lq=1">link</a>. Is it true here?</p>