https://bugs.llvm.org/show_bug.cgi?id=42862
Bug ID: 42862
Summary: -Waddress-of-packed member should not trigger inside
typeof/decltype/sizeof
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: arichardson....@gmail.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
I noticed that -Waddress-of-packed member triggers inside a typeof expression:
struct foo {
char c;
int member;
} __attribute__((packed));
int* good(struct foo* f) {
__typeof__(&(f->member)) ptr = 0;
return ptr;
}
int* bad(struct foo* f) {
return &f->member;
}
GCC compiles this code fine and only complains when actually taking the
address.
Example: https://godbolt.org/z/XMrchk
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs