[Bug c++/17124] GDB incorrectly says that std::string::npos is of type string

jwakely.gcc at gmail dot com sourceware-bugzilla@sourceware.org
Mon Jul 7 19:30:00 GMT 2014


https://sourceware.org/bugzilla/show_bug.cgi?id=17124

Jonathan Wakely <jwakely.gcc at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely.gcc at gmail dot com

--- Comment #1 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
Reproducible with this smaller program:

typedef unsigned long size_t;

template<typename T>
struct allocator
{
  typedef size_t size_type;
};

template<typename T, typename A = allocator<T> >
struct basic_string
{
  typedef typename A::size_type size_type;
  static const size_type npos = -1;
};

typedef basic_string<char> str;


int main()
{
  str s;
  return 0;
}


(gdb) ptype str::npos
type = struct basic_string<char, allocator<char> > [with T = char, A =
allocator<char>] {
    static size_type npos;

    typedef A::size_type size_type;
}

(N.B. I had to call the type 'str' because when I called it 'string' GDB got
confused and "ptype string::npos" gave a syntax error)

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Gdb-prs mailing list