libstdc++ not conforming with --enable-concepts-check?

Paolo Carlini pcarlini@suse.de
Wed Sep 22 14:37:00 GMT 2004


magfr@lysator.liu.se wrote:

>Hello.
>
>If I try to compile the attached program and have built the compiler with
>--enable-concept-checks that fails but as far as I can see from the standard
>queue only requires that the elements should be CopyConstructible, there is
>no requirement for DefaultConstructability, so I think that is a bug in the
>concept checking code.
>
Hi and thanks for your message: in my opinion, indeed, we have a bug.

The problem is tha we are enforcing a wrong requirement for sequences: 
compare
Table 67 with:

  template <class _Sequence>
  struct _SequenceConcept
  {
    typedef typename _Sequence::reference _Reference;
    typedef typename _Sequence::const_reference _Const_reference;

    void __constraints() {
      // Matt Austern's book puts DefaultConstructible here, the C++
      // standard places it in Container
      //    function_requires< DefaultConstructible<Sequence> >();
      __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();
      __function_requires< _DefaultConstructibleConcept<_Sequence> >();

      _Sequence
        __c _IsUnused(__n),             // line 730
        __c2 _IsUnused(__n, __t),
        __c3 _IsUnused(__first, __last);
      ...
      ...
      ...

The requirement enforced at line 730 is not present in Table 67 (*). 
Removing it
allows your testcase to compile. I'm now testing a complete patch.

Thanks,
Paolo.

(*) To be fair, "many" "real life" sequences fulfill it... ;)



More information about the Libstdc++ mailing list