[llvm-bugs] [Bug 41168] New: -Wunused-template false positive on unnamed struct

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 20 23:01:40 PDT 2019


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

            Bug ID: 41168
           Summary: -Wunused-template false positive on unnamed struct
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code triggers -Wunused-template (note that the object is neither
static nor in the unnamed namespace, so the compiler cannot determine whether
it is used):



constexpr struct {
    template<typename>
    void f() {}
} warning;




The warning is fixed by naming the struct:



constexpr struct NoWarning {
    template<typename>
    void f() {}
} no_warning;



See it live: https://godbolt.org/z/_XmWs-

-- 
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/20190321/034d8f5b/attachment-0001.html>


More information about the llvm-bugs mailing list