<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128902>128902</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
The presence of an overloaded operator in the same namespace prevents implicit conversions from occurring
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PiliLatiesa
</td>
</tr>
</table>
<pre>
The following example is rejected by Clang++, while accepted by G++, MSVC, and the EDG compiler.
```c++
namespace VF
{
struct FloatWrapper
{
double Data;
constexpr FloatWrapper() = default;
constexpr FloatWrapper(double const Data_) :
Data{Data_} {}
constexpr operator double const &() const
{ return Data; }
constexpr operator double &()
{ return Data; }
};
template<typename T>
concept CExpr = false;
template<CExpr T>
int operator +(T const &lhs, int const rhs) // Comment out this operator to make the example compile
{ return 6; }
} // VF
int main()
{
VF::FloatWrapper u;
u = 2.0 + u;
return 0;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVE2PmzwQ_jXmMtoITALJgUM-lr28r1Spq-2xMmYIbo1t2Sa7--8rGxISqZVWsmQx43nm43kY5pw4K8SKbA5kc0rY6Httq29Civ-YF-hY0uj2s3rtETotpX4X6gz4wQYjEYQDi7-Qe2yh-YSjZOpM6CGeI7z3QiIwztHMD14W5__f347hZqoF3yM8n16A68EIiXZF0n04RTodPoele8UGdIZxhLc6vCiDEcB5O3IPtdTM_7DMGLTRfvUDtHpsJMKJeUbyw4Qf7Fwr5_HD2MdguiV0ByQ_QYsdG6X_WtCcJfpjrp8TzDUQpgLKw-QrT7HC8vQ3aG3QMq8tPIASWszFxe8QRcoDWPSjVdf24IuQN7Bbef_EgnhfhxANHgcjmUeSH_2nwUANvJL8OTq5VoF2OD6HxGGQHZMOlzHeRU9vbqFC-aXSyPz2dele9i7IJjyabDYYdkBoTWgNRz0MGABGD74XbkHyGgb2G6PYrvqdBTe3f9d88TDFSNSEP8ku3Yf8AxPqNr-r1N7qQHe-v1cGjHfyGeM06CoNvT145tzpbJqyX_-B2-Cnk7RV3u7yHUuwysp1utmWWblJ-gopxy4tCtblaVryjK_XTVHmrOHtepuVLBEVTekmpbTIClpkm1VWbLdFwQraNm1XdJysUxyYkCspL8NK23MinBuxyuh2l9JEsgali_uCUoXvEL2E0rA-bBWCnprx7Mg6lcJ5t8B44SXGTWIsOlQcQXfAFOgLWqlZi-1Cl1CRKRdUtfz1xuIFlXcgBiMFF1EEF7ROaOWgs3oAzflorVDnZLSy6r03LjAS6TsL34_NiuuB0DrUNV9PxuqwxgitYzeO0Hpu91LRPwEAAP__5e-P5w">