diff mbox

libstdc++: fix ext/rope::dump() bug

Message ID CADhYE8Dim1BtL+SJpsVcH__GKs1bvmpgXv3hm6NcjAVVR_=FCQ@mail.gmail.com
State New
Headers show

Commit Message

Georeth Chow July 25, 2016, 12:26 p.m. UTC
Hello, maintainers.

Recently, I tried to figure out how the rope container works by
dumping the content. I found that the implementation of rope::dump()
has a misspell bug which use a static member function as a enum value.

It seems that the original SGI STL implementation doesn't have this bug.

bug trigger code below.

#include <ext/rope>
int main() {
    __gnu_cxx::crope r(100, 'x');
    r.dump();
    return 0;
}

patch is attached.

Thanks,
Georeth

Comments

Jonathan Wakely July 25, 2016, 12:56 p.m. UTC | #1
On 25/07/16 20:26 +0800, Georeth Chow wrote:
>Hello, maintainers.
>
>Recently, I tried to figure out how the rope container works by
>dumping the content. I found that the implementation of rope::dump()
>has a misspell bug which use a static member function as a enum value.
>
>It seems that the original SGI STL implementation doesn't have this bug.
>
>bug trigger code below.
>
>#include <ext/rope>
>int main() {
>    __gnu_cxx::crope r(100, 'x');
>    r.dump();
>    return 0;
>}
>
>patch is attached.

Thanks for the patch, I've committed it to trunk.

    Fix missing qualification in <ext/rope>
    
    2016-07-25  Georeth Chow  <georeth2010@gmail.com>
    
        * include/ext/ropeimpl.h (rope<>::_S_dump(_RopeRep*, int)): Qualify
        _S_concat enumerator.
        * testsuite/ext/rope/6.cc: New test.
diff mbox

Patch

diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
index 4316af7..93bd152 100644
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -1117,7 +1117,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  printf("NULL\n");
 	  return;
 	}
-      if (_S_concat == __r->_M_tag)
+      if (__detail::_S_concat == __r->_M_tag)
 	{
 	  _RopeConcatenation* __c = (_RopeConcatenation*)__r;
 	  _RopeRep* __left = __c->_M_left;