[LLVMbugs] [Bug 8075] New: False positive with -Wuninitialized when accessing *static* class members

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 3 13:20:10 PDT 2010


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

           Summary: False positive with -Wuninitialized when accessing
                    *static* class members
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: quality-of-implementation
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


% cat t4.cc 
struct S1 {
  enum { FOO = 42 };
  static const int bar = 42;
  static int baz();
  S1(int);
};

const int S1::bar;

struct S2 {
  S1 s1;
  S2() : s1(s1.FOO) {}
};

struct S3 {
  S1 s1;
  S3() : s1(s1.bar) {}
};

struct S4 {
  S1 s1;
  S4() : s1(s1.baz()) {}
};

% ./bin/clang -fsyntax-only -Wall t4.cc
t4.cc:12:13: warning: field is uninitialized when used here [-Wuninitialized]
  S2() : s1(s1.FOO) {}
            ^
t4.cc:17:13: warning: field is uninitialized when used here [-Wuninitialized]
  S3() : s1(s1.bar) {}
            ^
2 warnings generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list