public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/33605] New: Comparable concepts cause errors with abstract types
@ 2007-09-30 22:42 gcc at david dot osborn dot name
2007-09-30 22:48 ` [Bug libstdc++/33605] " gcc at david dot osborn dot name
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: gcc at david dot osborn dot name @ 2007-09-30 22:42 UTC (permalink / raw)
To: gcc-bugs
The following code fails because __gnu_cxx::_LessThanOpConcept has member
variables of type <iterator>::value_type, where <iterator> is an iterator over
an abstract type. 20.1.2 (LessThanComparable) doesn't mention that the type
has to be concrete.
#define _GLIBCXX_CONCEPT_CHECKS
#include <algorithm>
#include <tr1/memory>
#include <vector>
#include <boost/iterator/indirect_iterator.hpp>
struct AbstractThing
{
virtual void F() = 0; // comment this out and it works
};
struct ConcreteThing : AbstractThing
{
void F() {}
};
bool operator <(const AbstractThing &, const AbstractThing &)
{
return false;
}
int main()
{
typedef std::vector<std::tr1::shared_ptr<AbstractThing> > Things;
Things things;
std::lower_bound(
boost::make_indirect_iterator(things.begin()),
boost::make_indirect_iterator(things.end()), ConcreteThing());
}
$ g++ -I../../../boost.1.34.0 -otest test.cpp
C:/devel/mingw/include/c++/4.2.1/bits/boost_concept_check.h: In instantiation
of
'__gnu_cxx::_LessThanOpConcept<AbstractThing, ConcreteThing>':
C:/devel/mingw/include/c++/4.2.1/bits/boost_concept_check.h:63: instantiated
f
rom 'void __gnu_cxx::__function_requires() [with _Concept =
__gnu_cxx::_LessThan
OpConcept<AbstractThing, ConcreteThing>]'
C:/devel/mingw/include/c++/4.2.1/bits/stl_algo.h:2894: instantiated from
'_For
wardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)
[w
ith _ForwardIterator =
boost::indirect_iterator<__gnu_cxx::__normal_iterator<std
::tr1::shared_ptr<AbstractThing>*,
std::vector<std::tr1::shared_ptr<AbstractThin
g>, std::allocator<std::tr1::shared_ptr<AbstractThing> > > >,
boost::use_default
, boost::use_default, boost::use_default, boost::use_default>, _Tp =
ConcreteThi
ng]'
test.cpp:26: instantiated from here
C:/devel/mingw/include/c++/4.2.1/bits/boost_concept_check.h:299: error: cannot
d
eclare field '__gnu_cxx::_LessThanOpConcept<AbstractThing, ConcreteThing>::__a'
to be of abstract type 'AbstractThing'
test.cpp:8: note: because the following virtual functions are pure within
'Abs
tractThing':
test.cpp:9: note: virtual void AbstractThing::F()
--
Summary: Comparable concepts cause errors with abstract types
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at david dot osborn dot name
GCC build triplet: i686-pc-mingw32
GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33605
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-01 19:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-30 22:42 [Bug libstdc++/33605] New: Comparable concepts cause errors with abstract types gcc at david dot osborn dot name
2007-09-30 22:48 ` [Bug libstdc++/33605] " gcc at david dot osborn dot name
2007-10-01 10:06 ` pcarlini at suse dot de
2007-11-01 19:57 ` pcarlini at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).