https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90910
Bug ID: 90910 Summary: Missed namespace searching when operating on packed fields Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at brej dot org Target Milestone: --- Created attachment 46496 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46496&action=edit Overloading operators on a packed member reproducer When overloading operators on a packed member, if the packing size is different than the default size of the member, the namespace of the member is not searched for the overloaded operator. See attached example Within a namespace NAMESPACE, a class CLASS formed with a packed enum ENUM. When we apply an overloaded operator (in this case "<<"), the namespace of the ENUM os not searched for the overloaded implementation. Instead the enum is cast into an int and the int operator is used. It is searched correctly is the class member is not packed, or if it is packed to 32bits (cases a and c) as it does when using clang.