Silent breaking of constructor calls after adding initializer_list constructor : <p>Let's consider the following:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;initializer_list&gt;

class Foo {
public:
    Foo(int) {
        std::cout &lt;&lt; "with int\n";
    }
};

int main() {
    Foo a{10};  // new style initialization
    Foo b(20);  // old style initialization
}
</code></pre>

<p>Upon running it prints:</p>

<pre><code>with int
with int
</code></pre>

<p>All good. Now due to new requirements I have added a constructor which takes an initializer list.</p>

<pre><code>Foo(std::initializer_list&lt;int&gt;) {
    std::cout &lt;&lt; "with initializer list\n";
}
</code></pre>

<p>Now it prints:</p>

<pre><code>with initializer list
with int
</code></pre>

<p>So my old code <code>Foo a{10}</code> got silently broken. <code>a</code> was supposed to be initialized with an <code>int</code>. </p>

<p>I understand that the language syntax is considering <code>{10}</code> as a list with one item. But how can I prevent such silent breaking of old code?</p>

<ol>
<li>Is there any compiler option which will give us warning on such cases? Since this will be compiler specific I'm mostly interested with gcc. I have already tried <code>-Wall -Wextra</code>.</li>
<li>If there is no such option then do we always need to use old style construction, i.e. with <code>()</code> <code>Foo b(20)</code>, for other constructors and use <code>{}</code> only when we really meant an initializer list?</li>
</ol>
