<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66946>66946</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang crashes with concept on std::visit overload
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rconde01
</td>
</tr>
</table>
<pre>
Using [clang 16 via godbolt](https://godbolt.org/z/EM37xKjjq)
```
#include <iostream>
#include <variant>
template<typename T>
concept HasThing = requires { T::thing; };
struct A {
bool thing;
};
struct B {
};
template<class... Ts>
struct overloaded : Ts... {
using Ts::operator()...;
};
template<class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;
auto main() -> int {
std::variant<A,B> v = B{};
std::visit(overloaded{
[](HasThing auto const& o){
std::cout << "Has thing" << std::endl;
},
[](auto const &o){
std::cout << "Doesn't have thing" << std::endl;
}
},v);
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclMuOozoQhp-m2FiNoBwgLFiEJKilo7PLPIAx7uCWsdO2Yabn6Udcmlx6LpqJIqJU_eX6Sv4p5pw8ayEKSEpIDgHrfWtsYbnRjYjioDbNe_HFSX0mkJRcMX0mcUoGycjZNLVRHpID4Lb1_uKA7gArwGpJhcaeAavvgNXxf5p9--_19Q0wh-gA0W55ptHynf8ilZqrvhEE6F4a561gHdDjz9IDs5Jpf81OTy-6i2JeAN3794vQrBPktGq40VxcPHlm7tROU9EDseKtl1Y4Alk5andAd37MAi0JZAeg5W0H523PPdmN8jlCCCG1MYp8VC3yX5WW19LPmpsBuGLOhWFITm6dYDnCDMIqwxrREKA7cppkd0D9dGsnN89jLsIybyzgFjAPw_A3lH8guLYG3E6NAXPyBPR4QwV0P6fo8eF01ntDOib1jDIXSu3v6Z1vZvD1lvc7wH05iofp1spR_4n9vlY66QG3N1i3PcbP7HvA7eqIiY8b7TxgSsxo2Meiuybc9H60I9A9AcRn5hYbIH6EV63QjVqBV4TsALhfYivPFYMApn-NcTDCacDMk5YN4h-I1sCMN4wAt5a5f32DpqBNTnMWiCJO8wRplmIetEUUi_yFN0mSsewl2WzyqE4ZZTUizTIW00AWGCGNcoziHCPMw5csS-O0iTOM-JYKDptIdEyqUKmhG1dKIJ3rRZGm-SYNFKuFctP6Qpz2EyCOm8wWo_6p7s8ONpGSzrvrCV56JYp5nXHLXCsc-Sp9Sz72g9EPLlqtHfRWFQ_rTvq2r0NuOsBq7LH8PF2seRXcA1YTsgOsJuofAQAA__9foYS2">