rsmith added a comment.

In https://reviews.llvm.org/D29877#765968, @EricWF wrote:

> I think this patch still gets the following case wrong:
>
>   // foo.h
>   constexpr struct {
>     template <class T> void operator()(T) {} // emits unused template warning
>   } foo;
>


What specifically do you think is wrong here? There is an unused internal 
linkage function template here. If we want to warn on unused internal linkage 
templates declared in headers, we should warn on this one.

Note that any use of `foo` here from an inline function would result in ODR 
violations (because you get a different `foo` in each translation unit), so 
it's probably at least a bad idea to do that. We could suppress this warning 
for unused internal linkage templates declared in headers, or maybe move that 
to a separate warning flag; can you point us at some code that does this in 
practice and isn't wrong?


https://reviews.llvm.org/D29877



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to