https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118631
Bug ID: 118631 Summary: Public class member as const reference to protected member Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: i...@joerg-brueggmann.de Target Milestone: --- Created attachment 60253 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60253&action=edit cpp-file as self contained bug report Dear all, in the public member 'msets' is a const reference to the protected member 'msets_'. class StringSet { ... public: const std::set< std::string >& msets; protected: std::set< std::string > msets_; It was assumed that both members 'msets' and 'msets_' will ALWAYS represent the same content. But it seems that I created some code where this it is not the case. Please, find the details in the attachment. Thank you. Best regards Jörg Brüggmann