http://llvm.org/bugs/show_bug.cgi?id=16682
Bug ID: 16682
Summary: rvalue overload hides the const lvalue one?
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
struct A{};
struct B{operator const A()const;};
void f(A const&);
#ifdef ERR
void f(A&&);
#endif
int main(){
B a;
f(a);
}
Compiled with clang++ -std=c++11, it is happy. If I add -DERR, clang++
complains:
l.cc:9:5: error: no viable conversion from 'B' to 'A'
f(a);
^
l.cc:1:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'B' to 'const A &' for 1st argument
struct A{};
^
l.cc:1:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'B' to 'A &&' for 1st argument
struct A{};
^
l.cc:2:10: note: candidate function
struct B{operator const A()const;};
^
l.cc:5:11: note: passing argument to parameter here
void f(A&&);
^
1 error generated.
The error message is not very helpful, and g++ accepts the code. This happens
quite easily with the standard library (list::push_front for instance).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs