<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61988>61988</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang rejects call to templated conversion operator on derived class
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pkasting
</td>
</tr>
</table>
<pre>
The following code compiles in gcc and MSVC, but not Clang:
template <typename>
struct A {};
struct Base {
template <typename T>
operator A<T>() const;
};
class Derived : public Base {};
void foo() {
Derived().operator A<int>(); // error: no member named 'operator A' in 'Derived'
};
(See https://godbolt.org/z/Kfsf7acs7 )
Critically, this works if:
* foo() calls this on Base() instead of Derived()
* The called method is named "foo<T>()" instead of "operator A<T>()"
* The called method is not itself a template (e.g. a non-templated "operator A<int>()")
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU02TqzYQ_DXDZWpdMLINHDj4I76kcnqvchdowMoKiZKEtza_PiXWsdlstt4FqtSa7p5pjQxBD5a5gd0RdudMzvHqfDO9yhC1HbLWqffm55Wxd8a4N20H7Jxi7Nw4acMBtcWh61BahX_8-PMEdMJ2jmhdxJORdgBxgPwM-f0beZyMjIwgTvF9YitHBvHbBxiin7uIB4TyCOUZxHFdekePMvByYTlE_D9G_PngRHQTexmdxwOI0wJQBVRj52yIT40vep2RIeCZvb6xQhAHnObW6O7p4EvJzWmFvXN3hZXLO80HsPlkSdv4MAXiiAh0Aboge-98krUORx5b9ph6UwhUrgioTBkAlQ-J8ruOgKofzHiNcQopl0VncKp1Jm6cH4AufwNdfu9DX8oulJgcrepPXkfdSWPeU8zxqgO-Of8aUPfPmOmwmkC6HD5uOrsM7g5oGyJLha7_PJonSXp0qZwVjhyvTqEOjwFQklinCURrTiD6JnYg-pWGi6hjYNOjXL0uqngzbFCidfbl32P1RelTmkRAdaYaoWpRy4ybYl_lVZFTXmfXRtX5llUr6r4qRLfbiZ5IFYJF38p9VXCmG8pJ5Nt8X9RbQfVmW8m2FdtCVgWXZUmwzXmU2myMuY0pwUyHMHOzL-qqyoxs2YRls4ksv-ECJlO7c-abVPPSzkOAbW50iOHJEnU03Cz7i57_4i6GZU4YHT5b75y9sQ_a2eeOOYvqvjHL_mSzN81_HpyO17nddG4EuiTJ--9l8i5JAV0WowHosjTyTwAAAP__JjZmjw">