Issue |
128902
|
Summary |
The presence of an overloaded operator in the same namespace prevents implicit conversions from occurring
|
Labels |
new issue
|
Assignees |
|
Reporter |
PiliLatiesa
|
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;
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs