This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] libstdc++/31440


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]