<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57046>57046</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Wrong constructor is chosen by requires clause among multiple available constructors
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++20
      </td>
    </tr>

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

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

<pre>
    ```
#include<assert.h>
template<unsigned N>
struct Foo {
  Foo() requires (N==1) { assert(0);}
  Foo() requires (N==2) = default;
};

template <typename T, unsigned N>
struct S {
  T data;
  S() requires (N==1) { assert(0); }
  S() requires (N==2) = default;
};

int main() {
  S<Foo<1>, 2> s1;
  return 0;
}
```
**Expected**: User defined constructor for `Foo<1>` should be chosen leading to runtime failure. 
**Actual**: Clang currently chooses the default constructor (of `Foo<2>`)  for `Foo<1>`.

**Note**: Converting any of the `default` constructors (among `Foo<2>` and `S<*, 2>`) leads to expected assertion failure.
**Note**: `S<Foo<2>, 1>` works fine. Causes expected assertion failure.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVEtz2yAQ_jXoslMNQpYcHXTwIznmknR6RgJZtBhcHmn877tYfiiZpq8ZPLDA7vdY5M6KY0tqeh50S-iKsFKZXkchSbnh3ksX8pGU99NpkPuD5iGdRePVzkgBj9dTH1zsAzxYC2S5nvYghYTdEdaAk9-jctIDxpi1xVGkfbwMExQeUNwh5Zost39VgJ0KlFsQcuBRh5Q6CcEC1_Ub8nh9E44HafhewjNhG_hYy9NcyTMIHvi1KsDTfwiDmbLf5P-DLmUC7Lky52Izwk-oNLlXbookDJUynMEXMw1OhugM0DcA0-L9y0jj_vUg-yDFFJFyBZ9RX2KpkoG9NZNz1sGAP8yeEagp-NFGLaCT0I_WSwNacqHMDoIFF01Q2JOBKx2dzGEOvOpD5PoGu9Ecs_ronDRBH1M5rOchjPLi2Rs26I4dbnzYxCcZ9kui-dzhCfXR4sO_4Vvzgo1N1Lk5AtZOyJh5aRiKneGfesv3Fq-_54D5Im2mbp3qT206s0v--OSOPDt_flHKmqtRH7M8l53hYfVLL35Y981DalwOGx6Te38EyWRb1DUtSlo1RSbaUjRlw7OggpbtF5f0zV1X_tLn7nh75r1OaDDZsUez1EFj-IJIvMPV3LcsOt2OIRw86iHsAcdOhTF2eW_3GGj9cpk-HZz9ivQxVN5H6XFRLemizsaWDc1SCDrwmnd9V8ilqJvFopZNLWpWM5ohstS-JdWaMNYThtOaYQcYqbaZahlljN4VtChYWdCcyW6o-6phssIxdGRBJX6DOk88cut2mWtPlLq483iolQ_-dojupj8ceYLD-jyG0bo2-temyk7c2xPxnxrZpJw">