<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60258>60258</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Invalid constructor SFINAE for std::shared_ptr's array ctors
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
huixie90
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ldionne
</td>
</tr>
</table>
<pre>
This was reported to me by Marshall Clow (thanks!)
The SFINAE criteria for `shared_ptr`'s constructors don't seem right. Consider the following code:
```
#include <tuple>
#include <cassert>
#include <memory>
int main () {
std::shared_ptr<int> i;
std::shared_ptr<int[5]> i5a = i;
std::shared_ptr<int[]> iUa = i;
std::shared_ptr<int[]> iUb = i5a;
std::shared_ptr<int[5]> i5b = iUa;
std::shared_ptr<int[7]> i7 = i5a;
}
```
clang + libc++ accepts it (C++17).
gcc + libstdc++ rejects it (C++17)
msvc rejects it (C++17)
```
<source>(7): error C2440: 'initializing': cannot convert from 'std::shared_ptr<int>' to 'std::shared_ptr<int [5]>'
<source>(8): error C2440: 'initializing': cannot convert from 'std::shared_ptr<int>' to 'std::shared_ptr<int []>'
<source>(10): error C2440: 'initializing': cannot convert from 'std::shared_ptr<int []>' to 'std::shared_ptr<int [5]>'
<source>(11): error C2440: 'initializing': cannot convert from 'std::shared_ptr<int [5]>' to 'std::shared_ptr<int [7]>'
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlU2P2zYQhn_N6DKIIQ0l0z7o4I8YyKG9NDkXFDWW2FKkQVK73f76gvIau2nd7aZogAIGbXLm4bz88qtiNINjbqHZA9E4m98Mb0sgguZYqDmNPrS2N945LjrfP7WfRxPxUUUMfPEhcY_J48TYPeEPKsRRWYsH6x8RaJNG5X6NQBXQFsojlLtr-3lk_On06cfdR9TBJA5G4dkHhHUZRxW4__mSAqxLIBlRexdTmHXyIWLvHZBMGJknDGYY0woP3kXTc8A0Mp69tf7RuAG17xnE7nXdPOX1c-2SME7buWcEcUjzxTKIj_diWsXIIf1NdOLJh6eX4NIal3BSxuV9ANoiyP0tvI2pz8rE7tVqxcG4XAANiPdkNvsGmuMCNApBHN8P3rgv_5brrlyjvl3qM_rl3ai8ofKvReXx_rkurbbKDQi0R2s6DbTPP5XWfEkRTcrncriOVhJou7pSg9Y3Jqb-hgX-hfVd7EpN8UH_Y9J9reIQ_Rz0cvNos2SLHXIIPuCB6rrMXSBpnElGWfO7cQOQzKNaOedTfiAPHBKeg59y5lu3C0jm9_pWFr6cV65zT-Xm_6HybZFV-T1VflX_P9jSqvreaptvkiv_LPfra1v0rei3YqsKbqu1rBtZVrUoxraq17U4Nxspm-7MXSd4vdElqXWnK02KCtNSSaKsqK5qIhKrLUnJdanrTV02Ta-hLnlSxq6sfZhWPgyFiXHmdl1Ssyms6tjGZ7t6edjPhhXaDH3o5iFCXVoTU3yZJplkuf3kHpQ1_WtbuXlRtqB7m5JdSIWgnnAxoWIOth1TusScSSeg02DSOHcr7SegUy74_PXhEnz-UwA6LYuIQKdlHX8EAAD__8noLCw">