[LLVMbugs] [Bug 20901] New: -Wunused-private-field false positive with __builtin_offsetof

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 10 20:52:58 PDT 2014


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

            Bug ID: 20901
           Summary: -Wunused-private-field false positive with
                    __builtin_offsetof
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: myriachan at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following C++ spuriously generates the "-Wunused-private-field" warning:

#include <cstdio>

class Meow
{
    int x;
    friend int main();
};

int main()
{
    std::printf("%zu\n", __builtin_offsetof(Meow, x));
    return 0;
}

prog.cc:5:9: warning: private field 'x' is not used [-Wunused-private-field]
    int x;
        ^

clang version 3.6.0 (trunk 217508) Target: x86_64-unknown-linux-gnu Thread
model: posix

-- 
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/20140911/1813f56d/attachment.html>


More information about the llvm-bugs mailing list