https://bugs.llvm.org/show_bug.cgi?id=40610
Bug ID: 40610
Summary: use of overloaded operator '[]' is ambiguous (with
template conversion operator)
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: chabs...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
#include <type_traits>
struct abc
{
operator bool *() { return {}; }
template <typename T> operator T *() { return {}; }
//template <typename T, typename U = std::enable_if_t<std::is_same_v<T,
std::remove_cv_t<T>>> > operator T *() = delete;
};
int main() {
abc{}[0];
return 0;
}
#1 with x86-64 clang 7.0.0
<source>:11:10: error: use of overloaded operator '[]' is ambiguous (with
operand types 'abc' and 'int')
abc{}[0];
~~~~~^~
<source>:11:10: note: built-in candidate operator[](_Bool *, long)
<source>:11:10: note: built-in candidate operator[](const _Bool *, long)
<source>:11:10: note: built-in candidate operator[](volatile _Bool *, long)
<source>:11:10: note: built-in candidate operator[](const volatile _Bool *,
long)
If second template is used instead - it compiles just fine.
GCC, MSVC and ICC all are happy with this code.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs