public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63391] New: Erroneous -Wsign-conversion with offsetof
@ 2014-09-27 18:53 ian at geometrian dot com
0 siblings, 0 replies; only message in thread
From: ian at geometrian dot com @ 2014-09-27 18:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63391
Bug ID: 63391
Summary: Erroneous -Wsign-conversion with offsetof
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ian at geometrian dot com
//Bug report:
// by Ian Mallett
// Compile with "g++ <name.cpp> -std=c++11 -Wsign-conversion
#include <cstdint>
#include <cstddef>
struct Foo {
char data;
};
int main(int /*argc*/, char* /*argv*/[]) {
int num = 6;
#if 0 //No warning
size_t offset = offsetof(struct Foo,data);
delete [] new char[offset*static_cast<size_t>(num)];
#else //warning
delete [] new char[offsetof(struct Foo,data)*static_cast<size_t>(num)];
#endif
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-27 18:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-27 18:53 [Bug c++/63391] New: Erroneous -Wsign-conversion with offsetof ian at geometrian dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).