[LLVMbugs] [Bug 10644] New: clang considers a method with rvalue reference ambiguous
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Aug 11 13:32:14 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10644
Summary: clang considers a method with rvalue reference
ambiguous
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rafael.espindola at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
g++ 4.6 with -std=c++0x compiles:
struct string {
string(const char* __s);
};
struct map {
int& operator[](const string& __k);
int& operator[](const string&& __k);
};
void foo() {
static map key_map;
key_map["line"];
}
but clang doesn't:
tracked_objects.ii:10:10: error: use of overloaded operator '[]' is ambiguous
(with operand types 'map' and 'const char [5]')
key_map["line"];
~~~~~~~^~~~~~~
tracked_objects.ii:5:8: note: candidate function
int& operator[](const string& __k);
^
tracked_objects.ii:6:8: note: candidate function
int& operator[](const string&& __k);
^
The "string" in the test is a reduction of libstdc++'s std::string.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list