<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79434>79434</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Warning when templated conversion function converts to different template
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
BMBurstein
</td>
</tr>
</table>
<pre>
Minimal sample:
```c++
#include <type_traits>
template <bool B>
struct S {
// #1
template <bool C = B, class = std::enable_if_t<!C>>
operator S<true>() const { return {}; }
// #2
// operator S<true>() const { return {}; }
};
int main() {
// S<true> b1;
// S<false> b2;
}
```
Even though the conversion function is only enabled to convert from `S<false>` to `S<true>`, it still produces a warning:
> warning: conversion function converting 'S<true>' to itself will never be used [-Wclass-conversion]
Note that enabling #2 instead of #1, which seems more likely to trigger this warning, in fact does not trigger it.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMuOqzgQ_RqzKSUCm0eyYHFJOrs7m7voZctAAZ4xdmQXifL3I0Me9EOzGcmKY_tUnVNVJ5Heq94gliyrWHaM5ESDdWX1u5qcJ1Qmqm17K38ro0apwcvxrJGJXyw-svjxmcfLahivwlpuuVCm0VOLwMSBbmf8ICcVeSbe1tGE41lLmlG1tRqqJ8CTmxqCP8CKe1IAAMZPjJ-AcZG8Lr9lOQATR6gYP0Cjpffz0VMbtItfaGSt8UN1H8TEgfHkEEgfvCGhPaOTZB38CerdhOGV7xjfQ2ONp6AJHNLkzCyvODJRQdhWta208m8F_F-G-bxmU4ZglMrck_zUtBUV1Mkz_guik9ovEP6iePI-pr2mfrugARrs1A9AA4YCLui8sga6yTQUvigP1ugbLL1vgewdRtA5OwLL4zU5y-MAud8--pPHYaKKwJPSGs7OtlODHiRcpTPK9F-9Kd5WLz_quotQpgfGi0_DKIICRR51B9fAZ_CCDmqEyWMLLKs277O7Nq_ELPtkgb8sIdAgaal7YREclPGEsgXbLU7mB7gOqhnAI44eRusQtPoH9S1oIKf6Hh3QoPyzntAIA51sCFqLHoylJ1DRNmpL0e7FXkZYJkWcJ7t4lxbRUHb1nnNE5F2R5RLzouB1nMm83qddhqKLVMljnsYJz5IkLnix7QRmRcJTxL3I42zH0hhHqfRW68u4ta6PlPcTlsU-FWmkZY3aP_5RXBlAm3rqPUtjrTz5Vxgp0li-LwXBdQguuv-S2_8alg9NaVXXoUNDz5hocrociM4-2GA2dK9omOptY0fGT4H3vm3Ozv6NDTF-mrV7xk-z_H8DAAD__-DNhZI">