C++ class type copy-initialization
<p>If I write </p>

<pre><code>T t = T();
</code></pre>

<p>T is a class.</p>

<p>I think this is calling T's default constructor and then the copy assignment operator.
But the compiler is allowed to get rid of the assignment.</p>

<p><strong>I'm trying to find the description of this behavior written in the C++ standard, but I can't find it.
Could you point me to the right spot in the standard?</strong></p>

<p>I'm asking this because I'm being asked to replace this :</p>

<pre><code>T t;
</code></pre>

<p>with</p>

<pre><code>T t = T();
</code></pre>

<p>because of a coding rule checking program.</p>

<p>and it happens that the T class is noncopyable and has a private copy constructor and copy assignment operator...
So I'd like to see that the compiler is effectively always getting rid of the copy in this case.</p>

<p><strong>edit:</strong>
I have been mislead by something weird:
the noncompyable class was actually inheriting from boost::noncopyable
in this case it does compile.
But if I declare the copy constructor and copy assignment operator private, it does not compile.
exemple. This compiles : </p>

<pre><code>class BA
{
protected:
    BA() {}
    ~BA() {}
private:
    BA( const BA&amp; );
    const BA&amp; operator=( const BA&amp; );
};

class A : BA
{
};

int main( void )
{
    A a = A();
    return 0;
}
</code></pre>

<p>and the following does not : </p>

<pre><code>class A
{
public:
    A() {}
    ~A() {}
private:
    A( const A&amp; );
    const A&amp; operator=( const A&amp; );
};

int main( void )
{
    A a = A();
    return 0;
}
</code></pre>
