[Bug c++/43789] warn about pointer arithmetic in sizeof (Wsizeof-array-decay)
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 16 17:33:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43789
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-09-16
CC| |manu at gcc dot gnu.org
Summary|warn about pointer |warn about pointer
|arithmetic in sizeof |arithmetic in sizeof
| |(Wsizeof-array-decay)
Ever confirmed|0 |1
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Testcase:
int foo(void){
char a[]="blabla";
return sizeof(a-1);
}
Clang:
<source>:4:16: warning: sizeof on pointer operation will return size of 'char
*' instead of 'char [7]' [-Wsizeof-array-decay]
return sizeof(a-1);
~^
More information about the Gcc-bugs
mailing list