public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc at david dot osborn dot name" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/33605] New: Comparable concepts cause errors with abstract types Date: Sun, 30 Sep 2007 22:42:00 -0000 [thread overview] Message-ID: <bug-33605-13405@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2007-09-30 22:42 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-09-30 22:42 gcc at david dot osborn dot name [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-33605-13405@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).