Throwing an array local to a try block : <p>From C++ Primer 18.1.1:</p>

<blockquote>
  <p>If the [thrown] expression has an array or function type, the expression is
  converted to its corresponding pointer type.</p>
</blockquote>

<p>How is it that this program can produce correct output of <code>9876543210</code> (g++ 5.2.0)?</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int main(){

    try{
        int a[10] = {9,8,7,6,5,4,3,2,1,0};
        throw a;
    }
    catch(int* b) { for(int i = 0; i &lt; 10; ++i) cout &lt;&lt; *(b+i); }

}
</code></pre>

<p>From the quote, <code>throw a</code> would create an exception object of type <code>int*</code> which is a pointer to the first element of the array. But surely the array elements of <code>a</code> would be destroyed when we exit the <code>try</code> block and enter the catch clause since we change block scope? Am I getting a false positive or are the array elements "left alone" (not deleted) during the duration of the catch clause?</p>
