https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83538
Bug ID: 83538 Summary: std::match_results C++14 conformance issue: reference != value_type& Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: andrey.y.guskov at intel dot com Target Milestone: --- C++14 standard (page 1123, see here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf#1137) says: namespace std { template <class BidirectionalIterator, class Allocator = allocator<sub_match<BidirectionalIterator>>> class match_results { public: typedef sub_match<BidirectionalIterator> value_type; typedef const value_type& const_reference; typedef value_type& reference; ... As of now, std::match_results implementation disagrees with the standard in that it does not consider 'reference' equal to 'value_type&'. I made a reproducer to prove that: #include <regex> template <class T1, class T2> struct diff { static const bool s = true; }; template <class T1> struct diff<T1, T1> { static const bool s = false; }; typedef std::match_results<wchar_t*, std::allocator<std::sub_match<wchar_t> > > m; int main() { return !printf((diff<m::reference, m::value_type&>::s)? "FAIL\n" : "PASS\n"); }