public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/10505: concepts checks fail if container of X is used as member variable of X
@ 2003-05-05 14:43 ehrhardt
  0 siblings, 0 replies; 2+ messages in thread
From: ehrhardt @ 2003-05-05 14:43 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, tjj

Synopsis: concepts checks fail if container of X is used as member variable of X

State-Changed-From-To: analyzed->closed
State-Changed-By: cae
State-Changed-When: Mon May  5 14:43:39 2003
State-Changed-Why:
    This is not a bug. According to the standard, the behaviour is
    undefined, if one tries to instantiate an STL-template with an
    incomplete type. gcc accepts this code and does the right thing,
    if concepts checks are disabled at compile time. If concepts checks
    are enabled, there is additional code that checks that STL template
    parameters meet the requirements of the standard. As an incomplete
    type doesn't meet these requirements, the code is rightfully rejected.
    
    See the diskussion following http://gcc.gnu.org/ml/gcc/2003-04/msg01516.html
    on the gcc-Mailinglist for more details.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10505


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libstdc++/10505: concepts checks fail if container of X is used as member variable of X
@ 2003-04-28 18:50 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-04-28 18:50 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, tjj

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 <list>
    
    class Foo {
        std::list<Foo> 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<Foo>':
    /home/bangerth/bin/gcc-3.4-pre/include/c++/3.4/bits/stl_list.h:369:   instantiated from `std::list<Foo, std::allocator<Foo> >'
    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<Foo, std::allocator<Foo> >'
    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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-05 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-05 14:43 libstdc++/10505: concepts checks fail if container of X is used as member variable of X ehrhardt
  -- strict thread matches above, loose matches on Subject: below --
2003-04-28 18:50 bangerth

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).