[llvm-bugs] [Bug 36568] New: Incorrect "uninitialized field" warning when using default initialized member in template constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 2 05:09:54 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36568

            Bug ID: 36568
           Summary: Incorrect "uninitialized field" warning when using
                    default initialized member in template constructor
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lje at napatech.com
                CC: llvm-bugs at lists.llvm.org

Compiling the program below gives, to my belief, an incorrect warning.
Clang 5.0.0, compile options: -Wall --std=c++14
Note: GCC doesn't give any warning.

---------------------------------------------------------------
struct Foo
{
    template <typename TFoo>
    Foo() : bar2(bar)
    {
    }
private:
    int bar = 101;
    int bar2;
};

---------------------------------------------------------------
<source>:4:18: warning: field 'bar' is uninitialized when used here
[-Wuninitialized]
    Foo() : bar2(bar)



Best regards
  Lars

-- 
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/20180302/1258bd01/attachment.html>


More information about the llvm-bugs mailing list