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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to