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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to