help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _GLIBCXX_CONCEPT_CHECKS usage


From: mathieu
Subject: Re: _GLIBCXX_CONCEPT_CHECKS usage
Date: Fri, 14 Sep 2007 15:37:38 -0000
User-agent: G2/1.0

On Sep 14, 4:21 am, Pedro Lamarão <pedro.lama...@gmail.com> wrote:
> On 13 set, 10:03, mathieu <mathieu.malate...@gmail.com> wrote:
>
>
>
> > On Sep 10, 9:42 pm, Pedro Lamarão <pedro.lama...@gmail.com> wrote:
>
> > > On Sep 7, 12:50 pm, mathieu <mathieu.malate...@gmail.com> wrote:
>
> > > > $ g++ -D_GLIBCXX_CONCEPT_CHECKS l.cxx 2>&1|
> > > > wc
> > > >      57     565   13383
> > > > $ g++ l.cxx 2>&1|
> > > > wc
> > > >      18     156    2784
>
> > > > Concept checking is making my output even worse... or am I missing
> > > > something here ?
>
> > > Well... I don't think turning "concept checking" on should be adding
> > > any code -- but you are also not turning optimizations on.
>
> > > Try adding -O2 and checking the size again.
>
> > $ g++ -O2 -D_GLIBCXX_CONCEPT_CHECKS l.cxx 2>&1| wc
> >      57     565   13383
> > $ g++ -O2  l.cxx 2>&1| wc
> >      18     156    2784
>
> > Output seems to contains the exact same number of bytes.
>
> > I don't understand what O2 was supposed to do here. I am only trying
> > to get human readable output from what I believe is implemented in gcc
> > now: concept checking.
>
> Oh, I read you all wrong. I totally misread that pipe to wc.
>
> -O2 won't really matter in this case.
>
> Paste the complete error messages together with the contents of that
> translation unit.
> It really seems something unexpected is going on.

First try:

$ g++-4.2 l.cxx
/usr/include/c++/4.2/bits/stl_algo.h: In function 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]':
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2829: error: no match for
'operator-' in '__last - __first'
/usr/include/c++/4.2/bits/stl_algo.h: In function 'void
std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator) [with _RandomAccessIterator =
std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2436: error: no match for
'operator-' in '__last - __first'
/usr/include/c++/4.2/bits/stl_algo.h:2438: error: no match for
'operator+' in '__first + 16'
/usr/include/c++/4.2/bits/stl_algo.h:2439: error: no match for
'operator+' in '__first + 16'
/usr/include/c++/4.2/bits/stl_algo.h: In function 'void
std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator)
[with _RandomAccessIterator = std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/stl_algo.h:2442:   instantiated from 'void
std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator) [with _RandomAccessIterator =
std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2352: error: no match for
'operator+' in '__first + 1'
/usr/include/c++/4.2/bits/stl_algo.h:2442:   instantiated from 'void
std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator) [with _RandomAccessIterator =
std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2358: error: no match for
'operator+' in '__i + 1'


Ok message is way too cryptic.

Now second try with concept checking:

$ g++-4.2 -D_GLIBCXX_CONCEPT_CHECKS l.cxx
/usr/include/c++/4.2/bits/stl_algo.h: In function 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]':
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2829: error: no match for
'operator-' in '__last - __first'
/usr/include/c++/4.2/bits/stl_algo.h: In function 'void
std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator) [with _RandomAccessIterator =
std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2436: error: no match for
'operator-' in '__last - __first'
/usr/include/c++/4.2/bits/stl_algo.h:2438: error: no match for
'operator+' in '__first + 16'
/usr/include/c++/4.2/bits/stl_algo.h:2439: error: no match for
'operator+' in '__first + 16'
/usr/include/c++/4.2/bits/boost_concept_check.h: In member function
'void
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<_Tp>::__constraints()
[with _Tp = std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>]'
/usr/include/c++/4.2/bits/stl_algo.h:2822:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/boost_concept_check.h:556: error: no match
for 'operator[]' in
'((__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i[((__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n]'
/usr/include/c++/4.2/bits/stl_algo.h: In function 'void
std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator)
[with _RandomAccessIterator = std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/stl_algo.h:2442:   instantiated from 'void
std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator) [with _RandomAccessIterator =
std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2352: error: no match for
'operator+' in '__first + 1'
/usr/include/c++/4.2/bits/stl_algo.h:2442:   instantiated from 'void
std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator) [with _RandomAccessIterator =
std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/stl_algo.h:2358: error: no match for
'operator+' in '__i + 1'
/usr/include/c++/4.2/bits/boost_concept_check.h: In member function
'void __gnu_cxx::_RandomAccessIteratorConcept<_Tp>::__constraints()
[with _Tp = std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int> >]'
/usr/include/c++/4.2/bits/boost_concept_check.h:554:   instantiated
from 'void
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<_Tp>::__constraints()
[with _Tp = std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>]'
/usr/include/c++/4.2/bits/stl_algo.h:2822:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/boost_concept_check.h:537: error: no match
for 'operator+=' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i +=
((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n'
/usr/include/c++/4.2/bits/boost_concept_check.h:538: error: no match
for 'operator+' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i +
((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n'
/usr/include/c++/4.2/bits/boost_concept_check.h:538: error: no match
for 'operator+' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n +
((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i'
/usr/include/c++/4.2/bits/boost_concept_check.h:539: error: no match
for 'operator-=' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i -=
((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n'
/usr/include/c++/4.2/bits/boost_concept_check.h:540: error: no match
for 'operator-' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i -
((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n'
/usr/include/c++/4.2/bits/boost_concept_check.h:542: error: no match
for 'operator-' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i -
((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__j'
/usr/include/c++/4.2/bits/boost_concept_check.h:543: error: no match
for 'operator[]' in
'((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__i[((__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>*)this)-
>__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int>
>::__n]'
/usr/include/c++/4.2/bits/boost_concept_check.h: In member function
'void __gnu_cxx::_ComparableConcept<_Tp>::__constraints() [with _Tp =
std::_List_iterator<int>]':
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >]'
/usr/include/c++/4.2/bits/boost_concept_check.h:530:   instantiated
from 'void
__gnu_cxx::_RandomAccessIteratorConcept<_Tp>::__constraints() [with
_Tp = std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int> >]'
/usr/include/c++/4.2/bits/boost_concept_check.h:554:   instantiated
from 'void
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<_Tp>::__constraints()
[with _Tp = std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>]'
/usr/include/c++/4.2/bits/stl_algo.h:2822:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/boost_concept_check.h:267: error: no match
for 'operator<' in
'((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__a <
((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__b'
/usr/include/c++/4.2/bits/boost_concept_check.h:268: error: no match
for 'operator>' in
'((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__a >
((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__b'
/usr/include/c++/4.2/bits/boost_concept_check.h:269: error: no match
for 'operator<=' in
'((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__a <=
((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__b'
/usr/include/c++/4.2/bits/boost_concept_check.h:270: error: no match
for 'operator>=' in
'((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__a >=
((__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >*)this)-
>__gnu_cxx::_ComparableConcept<std::_List_iterator<int> >::__b'
/usr/include/c++/4.2/bits/boost_concept_check.h: In member function
'void __gnu_cxx::_ConvertibleConcept<_From, _To>::__constraints()
[with _From = std::bidirectional_iterator_tag, _To =
std::random_access_iterator_tag]':
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_ConvertibleConcept<std::bidirectional_iterator_tag,
std::random_access_iterator_tag>]'
/usr/include/c++/4.2/bits/boost_concept_check.h:531:   instantiated
from 'void
__gnu_cxx::_RandomAccessIteratorConcept<_Tp>::__constraints() [with
_Tp = std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_RandomAccessIteratorConcept<std::_List_iterator<int> >]'
/usr/include/c++/4.2/bits/boost_concept_check.h:554:   instantiated
from 'void
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<_Tp>::__constraints()
[with _Tp = std::_List_iterator<int>]'
/usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
from 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>
>]'
/usr/include/c++/4.2/bits/stl_algo.h:2822:   instantiated from 'void
std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = std::_List_iterator<int>]'
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/boost_concept_check.h:224: error: conversion
from 'std::bidirectional_iterator_tag' to non-scalar type
'std::random_access_iterator_tag' requested

Alright last message make now sense, but why do I get so much output
(57 lines of non-sense). Why isn't the compiler simply outputting:

$ g++-4.2 -D_GLIBCXX_CONCEPT_CHECKS l.cxx
l.cxx:7:   instantiated from here
/usr/include/c++/4.2/bits/boost_concept_check.h:224: error: conversion
from 'std::bidirectional_iterator_tag' to non-scalar type
'std::random_access_iterator_tag' requested

Thanks
-Mathieu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]