https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80472
--- Comment #11 from Manuel López-Ibáñez <lopezibanez at gmail dot com> --- I'm not being pedantic for the sake of being pedantic. It is trivial to fix the #pragma as I explained above. However, that won't give the user any idea about which user code is triggering the warning. For that, we need to have at the point of warning a token that comes from user code or we need to propagate a user location to the tokens that made up this particular instantation of the template, so that the diagnostic code can windup the location stack and find the user code that triggered the warning. On Fri, 22 Mar 2019, 22:18 redi at gcc dot gnu.org, < gcc-bugzi...@gcc.gnu.org> wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80472 > > --- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- > (In reply to Manuel López-Ibáñez from comment #8) > > There is no negative n__ in user code. > > If you want to be pedantic, there's no __n at all in user code. Because > it's a > function parameter of std::advance. But clearly if the compiler says > "undefined > behaviour detected at this line" and the line has a comment saying > "undefined > if n is negative" then the user can figure out that the function got called > with negative n. > > Is that perfect? No. Is it better than printing nothing when UB is > detected? To > me the answer is obviously yes, so it seems like you're just objecting to > making improvements. > > -- > You are receiving this mail because: > You are on the CC list for the bug.