From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22454 invoked by alias); 28 Apr 2003 18:50:28 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 22431 invoked by uid 48); 28 Apr 2003 18:50:27 -0000 Date: Mon, 28 Apr 2003 18:50:00 -0000 Message-ID: <20030428185027.22430.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, tjj@aol.net From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, tjj@aol.net, gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/10505: concepts checks fail if container of X is used as member variable of X X-SW-Source: 2003-04/txt/msg01276.txt.bz2 List-Id: Old Synopsis: [sparc only] g++ 3.2.1 on sun won't compile obj with list ofobj as member data New Synopsis: concepts checks fail if container of X is used as member variable of X State-Changed-From-To: feedback->analyzed State-Changed-By: bangerth State-Changed-When: Mon Apr 28 18:50:27 2003 State-Changed-Why: This is actually a problem in libstdc++. If one switched on concepts checking, the following fails: ---------------------------- #include class Foo { std::list children; }; ------------------------------ g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc -D _GLIBCPP_CONCEPT_CHECKS /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/boost_concept_check.h: In instantiation of `__gnu_cxx::_SGIAssignableConcept': /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/stl_list.h:369: instantiated from `std::list >' x.cc:4: instantiated from here /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/boost_concept_check.h:184: error: ` __gnu_cxx::_SGIAssignableConcept<_Tp>::__a' has incomplete type x.cc:3: error: forward declaration of `class Foo' /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/boost_concept_check.h: In member function `void __gnu_cxx::_SGIAssignableConcept<_Tp>::__constraints() [with _Tp = Foo]': /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/stl_list.h:369: instantiated from `std::list >' x.cc:4: instantiated from here /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/boost_concept_check.h:176: error: ` __a' undeclared (first use this function) /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/boost_concept_check.h:176: error: (Each undeclared identifier is reported only once for each function it appears in.) It fails, since the concepts checks try to check for assignability, but at a time when class X is not yet complete. I think, this is a defect in the library, although one that is hard to work around. One possibility would be to move the concept checks from the class declaration to the body of the constructor -- at this time the class being used _must_ be complete. However, I'd better leave this to the experts in the field... W. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10505