<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVcuu2zYQ_Rp5Q0SQJT8XWlzbuEEWKVAk6J6SRjYbmhRIyq779T1DyY_ruECLGLIskcMzj3NmXNnmUm61NHtBfx1UpYIXUpxJuUZUdJAnZXsnHO2laxSMwoGE76hWrSKHI51WtQpCGVFb44Pr62CdT8V32LVWa3vmU7VtSDSWvDA24O3YKU3CGvH12x9bIU0jPm-3oupvez4ixrCSfEUnMrzAzuHC_BAncl5Zk-TrNMl2SfY23hfZeMXXIR7xbq1IlpthTeBzCxs7gFcGCQAqGi13IxQeis0j-Ii2ke5f0LADtFgHRBuSfPFfYNn7USrksroa36CT_B2XePPshOpATazBvbA-yEBHAsRzdZ9BuAgtwPM0G2IQj0H8orMrlUm-ZSZ_wtyAWfWC3LshV7WafoxvOLu7-mql0uxokEU1QPqD7XXzhJNHnOn_x2GxHewZenO82CjfaXnxsQ5GOndVsxn1J87SGSyBuDu9r5Q43L9eRG8aHA2QPCMphpbhqavOB8hddlAVU2DRjw-9dY20ta5SzBAwXoWWit97G-Ja1zlqyZGpKSneRDLfJHk-ZbF9G32OYXx0hOsh07Y3deAHlMgrQAmwDaDNNCLBuKGmH0z2vUK__2S4ZEPlbw3Daol-ledHFog0zFBFovcUcxTqOHbXPRYfJ0Ztu8snZVRQUqu_JTtOkVcy3zGJIXQeyQ7ck0kfi5BCh1g944tl3FkIvdwTm95iWz8y98UPlZbQyz4p0CWOWB4ocEzZo4WRckXhTCCvk95z6auLOEndE5fnYS1WGeMBQI9OfrMhEsRqiBMzOvSxAq2qY4rCtnG_c7bSdEzFl1g1LhlJr_QFRYPG4rQkHETHstC9B8fQFaLG6YvAYCdg30bXB97N2PfuCG9RMYvsaWQOQ-47j7iYIJfrqvVJUxbNuljLiezDwbryVEOf-EeRk97p8iM1exUOfTUyovXp-vMJCf6JIYRX5X1PUMj7vCjm08mhXNaLZr6q2mVBq1W-lNMqKxazBZ6yus3aZqJlRdqXLPT5bvLrLlWZZ3meTdE12SzPZ-kik6v1NKeinRWz5apNZhlhhuuUcVLr9hNXRkioxWNTQyn-vslK2Buia4RBBU3lSzLkdfjKeye8avdJDLmM8f4DCgOIcQ>53351</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            explicit constructor allowing a implicit narrowing conversion
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          vcarreira
      </td>
    </tr>
</table>

<pre>
    Clang exhibits a weird behaviour regarding the specifier explicit in constructors. The following code does not compile on MSVC and GCC but compiles in clang (even in the trunk version).

```
struct Foo {
    explicit Foo(int i) {}
};

struct Bar {
    explicit Bar(const int& i) {}
};

int main() {
    // As expected the following statement does not compile
    //Foo f{2.0}; 

    // As expected the following statement does not compile on MSVC, GCC
    // But it compiles in clang
    Bar b1{2.0}; // Does not fail on clang but it should
    Bar b2{2.1}; // Does not fail on clang but it should (however it displays the narrowing conversion warning)
}
```

My understanding is that the specifier when applied to a constructor should forbid this narrowing conversion. Quoting cppreference: ["1) Specifies that a constructor or conversion function (since C++11) or deduction guide (since C++17) is explicit, that is, it cannot be used for implicit conversions and copy-initialization."](https://en.cppreference.com/w/cpp/language/explicit)

Is this a bug? Are distinctions made between passing by value or passing by const&?

Note: the code is a simplification of the problem. It can be easily found in template classes where they have a explicit constructor on the form of: `explicit Foo(const T& value)`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVV2v2jgQ_TXhxWoUErjAQx4uoLvqQ1dateq7k0zAXWNHtgPL_vqeccLHpVRqVRRCYo_PfJwzQ2Wbc7nR0uwE_bdXlQpeSHEi5RpR0V4ele2dcLSTrlEwCnsSvqNatYocjnRa1SoIZURtjQ-ur4N1PhVfYNdare2JT9W2IdFY8sLYgLdDpzQJa8Snz183QppG_LXZiKq_7vmIGMNK8iUd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