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

            Bug ID: 82900
           Summary: Warn on initialization with self
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Following code 

struct Y { Y(Y&){} };

int main() {
  Y y(y);
}


Produces a useful warning on clang:

warning: variable 'y' is uninitialized when used within its own initialization
[-Wuninitialized]
  Y y(y);
    ~ ^


It would be nice to have this warning in GCC, especially because this case may
produce unexpected results after implementing Bug 82899

Reply via email to