forked from boostorg/concept_check
simplifiex bad_error_eg.cpp
[SVN r8478]
This commit is contained in:
@@ -169,14 +169,11 @@ a linked list.
|
|||||||
1 #include <list>
|
1 #include <list>
|
||||||
2 #include <algorithm>
|
2 #include <algorithm>
|
||||||
3
|
3
|
||||||
4 struct foo {
|
4 int main(int, char*[]) {
|
||||||
5 bool operator<(const foo&) const { return false; }
|
5 std::list<int> v;
|
||||||
6 };
|
6 std::stable_sort(v.begin(), v.end());
|
||||||
7 int main(int, char*[]) {
|
7 return 0;
|
||||||
8 std::list<foo> v;
|
8 }
|
||||||
9 std::stable_sort(v.begin(), v.end());
|
|
||||||
10 return 0;
|
|
||||||
11 }
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Here, the
|
Here, the
|
||||||
@@ -192,18 +189,18 @@ Appendix.
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
stl_algo.h: In function `void __merge_sort_loop<_List_iterator
|
stl_algo.h: In function `void __merge_sort_loop<_List_iterator
|
||||||
<foo,foo &,foo *>, foo *, int>(_List_iterator<foo,foo &,foo *>,
|
<int,int &,int *>, int *, int>(_List_iterator<int,int &,int *>,
|
||||||
_List_iterator<foo,foo &,foo *>, foo *, int)':
|
_List_iterator<int,int &,int *>, int *, int)':
|
||||||
stl_algo.h:1448: instantiated from `__merge_sort_with_buffer
|
stl_algo.h:1448: instantiated from `__merge_sort_with_buffer
|
||||||
<_List_iterator<foo,foo &,foo *>, foo *, int>(
|
<_List_iterator<int,int &,int *>, int *, int>(
|
||||||
_List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>,
|
_List_iterator<int,int &,int *>, _List_iterator<int,int &,int *>,
|
||||||
foo *, int *)'
|
int *, int *)'
|
||||||
stl_algo.h:1485: instantiated from `__stable_sort_adaptive<
|
stl_algo.h:1485: instantiated from `__stable_sort_adaptive<
|
||||||
_List_iterator<foo,foo &,foo *>, foo *, int>(_List_iterator
|
_List_iterator<int,int &,int *>, int *, int>(_List_iterator
|
||||||
<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)'
|
<int,int &,int *>, _List_iterator<int,int &,int *>, int *, int)'
|
||||||
stl_algo.h:1524: instantiated from here
|
stl_algo.h:1524: instantiated from here
|
||||||
stl_algo.h:1377: no match for `_List_iterator<foo,foo &,foo *> & -
|
stl_algo.h:1377: no match for `_List_iterator<int,int &,int *> & -
|
||||||
_List_iterator<foo,foo &,foo *> &'
|
_List_iterator<int,int &,int *> &'
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
In this case, the fundamental error is that
|
In this case, the fundamental error is that
|
||||||
@@ -219,7 +216,7 @@ the error may be obvious. However, for the uninitiated, there are several
|
|||||||
reasons why this message would be hard to understand.
|
reasons why this message would be hard to understand.
|
||||||
|
|
||||||
<OL>
|
<OL>
|
||||||
<LI> The location of the error, line 9 of <tt>bad_error_eg.cpp</tt>
|
<LI> The location of the error, line 6 of <tt>bad_error_eg.cpp</tt>
|
||||||
is not pointed to by the error message, despite the fact that Gnu C++
|
is not pointed to by the error message, despite the fact that Gnu C++
|
||||||
prints up to 4 levels deep in the instantiation stack.
|
prints up to 4 levels deep in the instantiation stack.
|
||||||
<LI> There is no textual correlation between the error message and the
|
<LI> There is no textual correlation between the error message and the
|
||||||
@@ -241,21 +238,21 @@ Library produces):
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
boost/concept_check.hpp: In method `void LessThanComparableConcept
|
boost/concept_check.hpp: In method `void LessThanComparableConcept
|
||||||
<_List_iterator<foo,foo &,foo *> >::constraints()':
|
<_List_iterator<int,int &,int *> >::constraints()':
|
||||||
boost/concept_check.hpp:334: instantiated from `RandomAccessIteratorConcept
|
boost/concept_check.hpp:334: instantiated from `RandomAccessIteratorConcept
|
||||||
<_List_iterator<foo,foo &,foo *> >::constraints()'
|
<_List_iterator<int,int &,int *> >::constraints()'
|
||||||
bad_error_eg.cpp:9: instantiated from `stable_sort<_List_iterator
|
bad_error_eg.cpp:6: instantiated from `stable_sort<_List_iterator
|
||||||
<foo,foo &,foo *> >(_List_iterator<foo,foo &,foo *>,
|
<int,int &,int *> >(_List_iterator<int,int &,int *>,
|
||||||
_List_iterator<foo,foo &,foo *>)'
|
_List_iterator<int,int &,int *>)'
|
||||||
boost/concept_check.hpp:209: no match for `_List_iterator<foo,foo &,foo *> &
|
boost/concept_check.hpp:209: no match for `_List_iterator<int,int &,int *> &
|
||||||
< _List_iterator<foo,foo &,foo *> &'
|
< _List_iterator<int,int &,int *> &'
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
This message rectifies several of the shortcomings of the standard
|
This message rectifies several of the shortcomings of the standard
|
||||||
error messages.
|
error messages.
|
||||||
|
|
||||||
<UL>
|
<UL>
|
||||||
<LI> The location of the error, <tt>bad_error_eg.cpp:9</tt> is
|
<LI> The location of the error, <tt>bad_error_eg.cpp:6</tt> is
|
||||||
specified in the error message.
|
specified in the error message.
|
||||||
<LI> The message refers explicitly to concepts that the user can look
|
<LI> The message refers explicitly to concepts that the user can look
|
||||||
up in the STL documentation (<a
|
up in the STL documentation (<a
|
||||||
|
Reference in New Issue
Block a user