<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112468>112468</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang accepts calls to undeclared (use-then declared) overloaded operators inside template functions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lyj-514328
</td>
</tr>
</table>
<pre>
clang accepts this error-looking code:
``` c++
#include <sstream>
using namespace std;
class ABC {};
template <typename T> void foo(T value) {
istringstream iss("hello world");
iss >> value;
}
int main() {
foo(ABC());
return 0;
}
```
This code is also accepted by GCC. But here the use of the overloaded operator precedes the declaration; Is this compliant with the C++ standard? Or is it a feature of clang/gcc.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU02PozAM_TXhYrWChBY4cBja6WpPe5k_EBK3ZDYkKA4d9d-vAm23I40U8ZHYzy_Pz5LIXBxiy3Yd2x0zOcfBh9bePje7ohS8znqvb62y0l1AKoVTJIiDIcAQfNhY7_8adwHlNTLxxvIjyx_Pfb4uUIx3aa3bXBin7KwRmDgQxYByZOL9NXWmhOnkiDRJhUBRM9G9RigrieCtOwCrOlYdn8cRx8nKuIDH24QJBD6YeIerNxrO3jNef8BV2hkZb5b0JRHAUAzGXVZGYIgYrxnnA1rr4csHqxnnjDfPWikGEvWEvgA-SVbHV7bGRRilcQvgt5orn7fusB69oj9CAsY5OMh_AH8ovP5-pLakRoAhkJb8vWGoob_Br8NhC90cYcCAEAeEmRD8efn0VwzWS40a_IRBRh9gCqhQIy0BGpWVQUbjHRMd_L6bQPlxska6CF8mDkvkYW02UJROy6CZOMGfkCiZCBLOKOMclsKLqRg_XZTaZroVuhGNzLAtKt7kZVOLKhva8tzX53JXKMl7bIrmXO12-77e7QXfi32PmWl5zssiL_a5EFVRbXmdq17qkosSa5UjK3McpbFba6_j1odLZohmbIuCl_s6s7JHS4v_Ob9T4mkUQpsSNv18IVbm1lCk_xDRRIvt4dtYKGktQfQwu1Uu1MB4PRNu4oAOHpvJAj8ITmAcGY3wtPB5diopTtkcbDvEOFGaMX5Kopk4zP1W-ZHxU6J1f22m4D9RRcZPyzWJ8dP9pteW_wsAAP__GMA1Eg">