https://bugs.llvm.org/show_bug.cgi?id=48755
Bug ID: 48755
Summary: clang permits write to const anonymous struct members
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Blocks: 4068
Via this LKML thread:
https://lore.kernel.org/lkml/[email protected]/T/#m1328d75e335d7e58bdd670ca30fea062b738f408
(Reported-by: Will Deacon <[email protected]>)
struct foo {
const struct {
int bar;
};
} my_foo;
struct foo2 {
const struct {
int bar;
} named;
} my_foo2;
void baz (void) {
my_foo.bar = 42; // GCC errors, clang does not
my_foo2.named.bar = 42; // GCC and Clang error
}
Marking `bar` as const qualified is a portable workaround, for now.
https://godbolt.org/z/h7qPxd
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=4068
[Bug 4068] [Meta] Compiling the Linux kernel with clang
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs