| Issue |
180476
|
| Summary |
Clang rejects implicit conversion from an integer lvalue reference to another integer rvalue reference via a conversion operator
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
ranaanoop
|
The following program is rejected by clang but accepted by both gcc and msvc. [Demo](https://godbolt.org/z/1ofEdhKzW)
```
#include <stdlib.h>
struct S
{
operator long &() const
{
exit(0);
}
};
int main() { int &&a((S())); }
```
Clang says:
```
<source>:9:20: error: no viable conversion from 'S' to 'int'
9 | int main() { int &&a((S())); }
| ^ ~~~~~
<source>:4:2: note: candidate function
4 | operator long &() const {
|
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs