[LLVMbugs] [Bug 9598] New: use of overloaded operator '[]' is ambiguous

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 31 13:44:05 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9598

           Summary: use of overloaded operator '[]' is ambiguous
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: cdubout at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=6386)
 --> (http://llvm.org/bugs/attachment.cgi?id=6386)
Test case

The attached code works fine in gcc and seem correct enough but fails with the
following errors using the clang++ compiler shipped with Xcode 4:

test.cpp:11:10: error: use of overloaded operator '[]' is ambiguous
        return a["a"];
               ~^~~~
test.cpp:6:9: note: candidate function
        double operator[](const std::string& str) { return 0.0; }
               ^
test.cpp:11:10: note: built-in candidate operator[](long, const char *)
        return a["a"];
                ^
test.cpp:11:10: note: built-in candidate operator[](long, const restrict char
*)
test.cpp:11:10: note: built-in candidate operator[](long, const volatile char
*)
test.cpp:11:10: note: built-in candidate operator[](long, const volatile
restrict char *)
1 error generated.

-- 
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