https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68058
Bug ID: 68058 Summary: _GLIBCXX_BEGIN_NAMESPACE_VERSION breaks regex Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: dmorilha at gmail dot com Target Milestone: --- when compiling libstdc++ with --enable-symvers=gnu-versioned-namespace std::regex complaining about private data members trying to be accessed outside the class: 22:55:46 /home/y/include/c++/4.9.2/bits/regex.h:796:30: error: ‘std::__7::basic_regex<char>::_AutomatonPtr std::__7::basic_regex<char>::_M_automaton’ is protected 22:55:46 _AutomatonPtr _M_automaton; I believe the bug is related with the __detail namespace[1] and friend classes[2] as it lacks the NAMESPACE_VERSION expansion. This happens in other lines and I believe it extends to hashmap as well. Turning data members public "fixes" the compilation problem. [1]: https://github.com/gcc-mirror/gcc/blob/e0f174323b4297f46d9109201666da42aaa55fc8/libstdc%2B%2B-v3/include/bits/regex.h#L46 [2]: https://github.com/gcc-mirror/gcc/blob/e0f174323b4297f46d9109201666da42aaa55fc8/libstdc%2B%2B-v3/include/bits/regex.h#L772