https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101850

--- Comment #4 from Prasanta Behera <prasantabehera at hotmail dot com> ---
FWIW clang++ does produce these warnings:

~$ cat t.cpp 
#include <string>

class M {
  std::string s;

public:
  M(std::string t) : s(t) {}
};

int main() {
  std::string s = s;
  M m = m;
  return 0;
}
~$ clang++ t.cpp
t.cpp:11:19: warning: variable 's' is uninitialized when used within its own
initialization [-Wuninitialized]
  std::string s = s;
              ~   ^
t.cpp:12:9: warning: variable 'm' is uninitialized when used within its own
initialization [-Wuninitialized]
  M m = m;
    ~   ^
2 warnings generated.
~$ clang++ --version
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Similar warnings for g++ too will help a lot!

Reply via email to