From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7134 invoked by alias); 25 Jan 2012 05:02:35 -0000 Received: (qmail 7121 invoked by uid 22791); 25 Jan 2012 05:02:33 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Jan 2012 05:02:20 +0000 From: "leonid at volnitsky dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51989] New: std::deque::iterator recognised as container Date: Wed, 25 Jan 2012 06:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: leonid at volnitsky dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg02854.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51989 Bug #: 51989 Summary: std::deque::iterator recognised as container Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: leonid@volnitsky.com Created attachment 26450 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D26450 deque-bug.cc I need is_container template which would recognize if T is a container.= =20 Code below works as expected. With exception for std::deque::iterator - g= cc can not compile code below: ------------------------------------------------------------------ #include #include #include #include #include #include template struct is_container { template static char test( U* u, typename U::const_iterator b =3D ((U*)0)->begin(), typename U::const_iterator e =3D ((U*)0)->end() ); template static long test(...); enum { value =3D sizeof test(0) =3D=3D 1 }; }; int main() { std::cout << "void\t" << is_container< void=20=20=20=20=20= =20=20=20=20=20=20=20 >::value << '\n'; std::cout << "int\t" << is_container< int >::v= alue << '\n'; std::cout << "int*\t" << is_container< int*=20=20=20=20=20= =20=20=20=20=20=20=20 >::value << '\n'; std::cout << "vector\t" << is_container< std::vector >::value << '\n'; std::cout << "deque\t" << is_container< std::deque=20 >::value << '\n'; std::cout << "set::iterator\t" << is_container< std::set::iterator >::value << '\n'; std::cout << "vector::iterator\t" << is_container< std::vector::iterator >::value << '\n'; // gcc error std::cout << "deque::iterator\t" << is_container< std::deque::iterator >::value << '\n'; } ----------------------------------------------------------------------- Compiling it with GCC (4.7.0-alpha20111203): gcc -std=3Dgnu++0x -Wall deque-bug.cc -o deque-bug Produce following error: deque-bug.cc: In instantiation of =E2=80=98struct is_container >=E2=80=99: deque-bug.cc:31:84: required from here deque-bug.cc:18:7: error: =E2=80=98struct std::_Deque_iterator=E2=80=99 has no member named =E2=80=98begin=E2=80=99 deque-bug.cc:18:7: error: =E2=80=98struct std::_Deque_iterator=E2=80=99 has no member named =E2=80=98end=E2=80=99 Attached are source and -save-temps