Issue 180577
Summary Implicit conversion from long rvalue reference to int rvalue reference via a conversion operator fails
Labels new issue
Assignees
Reporter Fedr
    This program
```c++
long nil = 0;

struct S {
    operator long &&() const { 
        return static_cast<long&&>(nil);
    }
};

int main() { 
    int &&a((S()));
 return a;
}
```
is accepted by GCC, EDG and MSVC. But not in Clang:
```
error: no viable conversion from 'S' to 'int'
```
Online demo: https://gcc.godbolt.org/z/M7W3oYsGz

This is a slightly modified example from https://stackoverflow.com/q/79885636/7325599
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to