rsmith added a comment.

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

> No. But I can point you to `range-v3` which uses this pattern and I think the 
> idiom is somewhat appealing, but that's orthogonal to Clang diagnosing it.


I found this:

https://github.com/ericniebler/range-v3/blob/a4829172c0d6c43687ba213c54f430202efd7497/include/range/v3/view/zip_with.hpp#L44

This code is wrong, and creates ODR violations on lines 190 and 200.

It seems to me that the warning is firing on dangerous / broken code (yay!) but 
the warning is not sufficient to explain *why* the code is broken (boo!). It 
also seems to me that the reason why we flag up this code is not really related 
to the reason why this code is broken, and we should probably have a separate 
diagnostic for using an internal linkage entity from within an entity to which 
the ODR applies that is defined within a header. If we had such a diagnostic, 
it would seem reasonable to limit this warning to only apply to code that is 
*not* in a header file -- but see PR22712 for a case where even that is not 
quite enough.


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