Is it legal to use previous function parameter to declare new one?
<p>The following code compiles cleanly with GCC:</p>

<pre><code>void func(int arg1, decltype(arg1) arg2)
{
    (void)arg2;
}
int main(){}
</code></pre>

<p>I used this command to compile:</p>

<pre><code>g++ -std=c++14 test.cpp -o test -pedantic-errors -Wall -Wextra
</code></pre>

<p>But such usage of a parameter in the middle of function declaration seems weird. Is it actually valid in standard C++, or is it a GCC extension?</p>