What's actually going on in this AnonymousClass(variable) declaration?
<p>Trying to compile:</p>

<pre><code>class AnonymousClass
{
public:
    AnonymousClass(int x)
    {
    }
};


int main()
{
    int x;
    AnonymousClass(x);
    return 0;
} 
</code></pre>

<p>generates errors from MSVC:</p>

<pre><code>foo.cpp(13) : error C2371: 'x' : redefinition; different basic types
    foo.cpp(12) : see declaration of 'x'
foo.cpp(13) : error C2512: 'AnonymousClass' : no appropriate default constructor available
</code></pre>

<p>g++'s error messages are similar:</p>

<pre><code>foo.cpp: In function ‘int main()’:
foo.cpp:13: error: conflicting declaration ‘AnonymousClass x’
foo.cpp:12: error: ‘x’ has a previous declaration as ‘int x’
foo.cpp:12: warning: unused variable ‘x’
</code></pre>

<p>It's easily fixable by giving the <code>AnonymousClass</code> object an explicit name, but what's going on here and why?  I presume that this is more declaration syntax weirdness (like the cases described in <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.2" rel="nofollow">Q10.2</a> and <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.21" rel="nofollow">Q10.21</a> of the comp.lang.C++ FAQ), but I'm not familiar with this one.</p>
