Issue 146377
Summary Wrong warning generated (gcc works OK)
Labels new issue
Assignees
Reporter socketpair
    The following code is pretty correct, but Clang emits warning. I consider it a bug.

```cpp
struct X {
    int x_field{};
};

struct Y {
    template <class>
    Y() : y_field(x.x_field) {}

    X x;
    int y_field;
};
```

https://godbolt.org/z/Y4Y7nMnTM

x86-64 clang (trunk) -O3 -std=c++20  -Wall -Wextra :
```
<source>:7:19: warning: field 'x' is uninitialized when used here [-Wuninitialized]
    7 |     Y() : y_field(x.x_field) {}
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to