[LLVMbugs] [Bug 19376] New: Missing -Wuninitialized warning for construction of member with another member using a constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 8 18:07:18 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19376

            Bug ID: 19376
           Summary: Missing -Wuninitialized warning for construction of
                    member with another member using a constructor
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akyrtzi at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This test case:
-------------
struct Bar {
    int val = 0;
};

struct Foo {
    Foo(const Bar& b) : val(b.val)
    {
    }

    int val;
};

class MyClass1 {
public:
    MyClass1();
private:
    Bar x;
    Bar y;
};

MyClass1::MyClass1() : x(y)
{
}

class MyClass2 {
public:
    MyClass2();
private:
    Foo x;
    Bar y;
};

MyClass2::MyClass2() : x(y)
{
}
-----------------

Only gives only warning:
test.cpp:21:26: warning: field 'y' is uninitialized when used here
      [-Wuninitialized]
MyClass1::MyClass1() : x(y)
                         ^
1 warning generated.


It should warn on MyClass2 as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140409/e6f856af/attachment.html>


More information about the llvm-bugs mailing list