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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to