This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[RFC] libstdc++/31440
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 03 Apr 2007 00:06:38 +0200
- Subject: [RFC] libstdc++/31440
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?
Thanks,
Paolo.