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: unassignedclangb...@nondot.org
          Reporter: da...@doublewise.net
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to