On Thu, 22 Jun 2017, Xi Ruoyao wrote: > I created PR 81172. For const char *p = "123" + 'c' we should have: > > warning: offset 99 is above array bounds, the behaviour is > undefined [-Warray-bounds] > const char *p = "123" + 'c'; > > and perhaps (for the case the pointer operand is a string or a string > pointer): > note: adding integer to a string does not append to the string.
I do think this makes sense. I'm really not convinced there is a lot of code out there that uses the "123" + i idiom to create a pointer, even if it is legitimate code, so a warning makes sense to me. Gerald