[llvm-bugs] [Bug 47718] New: -Wunused-private-field on member accessed via class template

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 3 05:01:42 PDT 2020


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

            Bug ID: 47718
           Summary: -Wunused-private-field on member accessed via class
                    template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ed at catmur.co.uk
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

class C {
    int i; // warning: private field 'i' is not used [-Wunused-private-field]
public:
    template<class> struct S { C& c; };
    template<class T> int f(S<T> s) { return ++s.c.i; }
};
https://godbolt.org/z/rnja44
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
88c9162c9d47ef43a505bc5301dc626f3cd4f437)

note that barring weird specializations, s.c is a C lvalue, so I think this
should be regarded as a use of C::i.

-- 
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/20201003/e4cf08aa/attachment.html>


More information about the llvm-bugs mailing list