Error: use of overloaded operator '[]' is ambiguous while building for i386
问题 Consider the following code: #include <stdio.h> #include <stdint.h> class test_class { public: test_class() {} ~test_class() {} const int32_t operator[](uint32_t index) const { return (int32_t)index; } operator const char *() const { return "Hello World"; } }; int main(void) { test_class tmp; printf("%d\n", tmp[3]); return 0; } When I use command clang++ -arch i386 test.cc to build those codes, it yields the following on clang++ (Apple LLVM version 9.1.0 (clang-902.0.39.1)): test.cc:24:21: