[libcxx-commits] [clang] [libcxx] [SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (PR #77768)
Yaxun Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 21 08:19:53 PST 2024
yxsamliu wrote:
This PR caused a regression for AMDMIGraphX https://github.com/ROCm/AMDMIGraphX/blob/develop/src/targets/gpu/include/migraphx/gpu/prefix_scan_sum.hpp#L57
A reduced test case is:
#include <vector>
#include <stdio.h>
using namespace std;
```
struct A {
int x;
A(int x_) : x(x_) {}
A(const vector<A>& a) {}
};
int main() {
vector<A> a{1,2};
vector<A> b{a};
printf("%ld\n", b.size());
}
```
For variable b, it is expected to be constructed by copy ctor of vector, and have 2 elements.
With this patch, a is first converted to A(a), then b is constructed with one element A(a).
Is this expected or a bug? Thanks.
gcc has the same behavior https://godbolt.org/z/hTb795xWP
https://github.com/llvm/llvm-project/pull/77768
More information about the libcxx-commits
mailing list