libstdc++: Fix link failure in _OutputIteratorConcept
authorJonathan Wakely <jwakely@redhat.com>
Tue, 25 Jan 2022 21:29:31 +0000 (21:29 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 2 Feb 2022 16:30:51 +0000 (16:30 +0000)
The C++98-style concept check for output iterators causes a link
failure on mingw-w64, because the __val() member function isn't defined.
Change it to use a function pointer instead. That pointer is never set
to anything meaningful, but it doesn't matter as the __constraints()
function only has to be instantiated, it's never called.

We could refactor all of these to use unevaluated contexts (e.g. sizeof
of __decltype) so that we only check the expressions are well-formed,
without any codegen at all. Any improvements to these are very low
priority though.

libstdc++-v3/ChangeLog:

* include/bits/boost_concept_check.h (_OutputIteratorConcept):
Change member function to data member of function pointer type.

libstdc++-v3/include/bits/boost_concept_check.h

index 23dba06..3d884eb 100644 (file)
@@ -483,7 +483,9 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
       *__i++ = __val();                 // require postincrement and assignment
     }
     _Tp __i;
-    _ValueT __val() const;
+    // Use a function pointer here so no definition of the function needed.
+    // Just need something that returns a _ValueT (which might be a reference).
+    _ValueT (*__val)();
   };
 
   template<typename _Tp>