<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124467>124467</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Maybe a bug of concept and vector
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
scarsty
</td>
</tr>
</table>
<pre>
These codes cannot be complied with clang 19, but of no problem with MSVC and GCC.
```c++
#include <iostream>
#include <string>
#include <vector>
class A
{
std::string a;
std::vector<A> v;
public:
A(int i) { a = std::to_string(i); }
int toInt() const { return atoi(a.c_str()); }
void pushBack(const A& a) { v.push_back(a); } // line 1
template <typename T>
requires requires(const A& a, T& t) { A2T(a, t); } // line 2
operator T() const
{
T t;
A2T(*this, t);
return t;
}
};
inline void A2T(const A& a, int& f) { f = a.toInt(); }
int main()
{
A a(20);
int f = a;
std::cout << f << std::endl;
return 0;
}
```
The error is
```c++
<source>:43:9: error: no viable conversion from 'A' to 'int'
43 | int f = a;
| ^ ~
<source>:23:5: note: candidate template ignored: constraints not satisfied [with T = int]
23 | operator T() const
| ^
<source>:22:47: note: because 'A2T(a, t)' would be invalid: use of undeclared identifier 'A2T'
22 | requires requires(const A& a, T& t) { A2T(a, t); }
| ^
1 error generated.
```
But if one of the line 1 or 2 is removed, things become OK. I guess it might be a bug of concept, does anyone have other idea?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU-P47YP_TTKhdjAlpI4OfjgZCY_LH5Y9NCg14Us07ZaW0ol2Yu59LMXlJxkdv4UPdQwEMWkHh8fKUp6rzuDWLLtkW2fVnIKvXWlV9L58LKqbfNSsqy69OgRlG3Qg5LG2AA1_R-vg8YGfujQgxqk6SA_MH6CegpgWzAWrs7WA47J5duvv51Amgb-dzqtWVbRu8vSqxg_0ptVjAtt1DA1CEyctPXBoRyZeH5n88Fp031kmVEF6xZLVqlBeg8xXkEhAAB8a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