This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] libstdc++/31440
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: 02 Apr 2007 19:07:13 -0500
- Subject: Re: [RFC] libstdc++/31440
- References: <46117E6E.6050307@suse.de>
Paolo Carlini <pcarlini@suse.de> writes:
| Hi,
|
| we just got this PR: Maude doesn't compile anymore, as un unintended
| effect of some recent work of mine on _Rb_tree::lower_bound,
| upper_bound, etc. Shame on me, I have a patch ready and tested (the
| issue is only in mainline). However, before going ahead wanted to make
| sure we all agree we want to accept this kind of code:
|
| #include <map>
|
| // libstdc++/31440
| struct DagNode
| { };
|
| class MemoTable
| {
| public:
| void memoRewrite();
|
| private:
| struct dagNodeLt;
| class MemoMap;
|
| MemoMap* memoMap;
| };
|
| struct MemoTable::dagNodeLt
| {
| bool operator()(const DagNode*, const DagNode*);
| };
|
| class MemoTable::MemoMap
| : public std::map<DagNode*, DagNode*, MemoTable::dagNodeLt>
| { };
|
| void
| MemoTable::memoRewrite()
| {
| memoMap->find(0);
| }
|
| Indeed, the interesting observation is that at least another common
| implementation doesn't accept it: in such cases, we are always at risk
| of encouraging non-portability (assuming of course the Standard isn't
| 100% clear about the case at issue). The problem pointed out is the
| same we have in mainline and the fix (constify operator()) also the
| same:
|
| .../bits/stl_tree.h:938: error: passing 'const MemoTable::dagNodeLt'
| as 'this' argument of 'bool MemoTable::dagNodeLt::operator()(const
| DagNode*, const DagNode*)' discards qualifiers
|
| Opinions?
I have had a very hard day, so I'm slow at puzzles :-( You seem to
understand where the issue is, so plesse could elaborate a bit on what
the problem is what solution you're proposing?
-- Gaby