PR libstdc++/65229 fix pretty printer for std::bitset<0>
2018-11-23 Martin Sebor <msebor@redhat.com> Jonathan Wakely <jwakely@redhat.com> PR libstdc++/65229 * python/libstdcxx/v6/printers.py (StdBitsetPrinter): Handle exception thrown for std::bitset<0>. * testsuite/libstdc++-prettyprinters/simple.cc: Test std::bitset<0>. Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r266409
This commit is contained in:
parent
11aa881f98
commit
14a9206d0c
|
@ -1,3 +1,11 @@
|
|||
2018-11-23 Martin Sebor <msebor@redhat.com>
|
||||
Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/65229
|
||||
* python/libstdcxx/v6/printers.py (StdBitsetPrinter): Handle
|
||||
exception thrown for std::bitset<0>.
|
||||
* testsuite/libstdc++-prettyprinters/simple.cc: Test std::bitset<0>.
|
||||
|
||||
2018-11-23 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/87308 (partial)
|
||||
|
|
|
@ -702,7 +702,13 @@ class StdBitsetPrinter:
|
|||
return '%s' % (self.typename)
|
||||
|
||||
def children (self):
|
||||
words = self.val['_M_w']
|
||||
try:
|
||||
# An empty bitset may not have any members which will
|
||||
# result in an exception being thrown.
|
||||
words = self.val['_M_w']
|
||||
except:
|
||||
return []
|
||||
|
||||
wtype = words.type
|
||||
|
||||
# The _M_w member can be either an unsigned long, or an
|
||||
|
@ -712,7 +718,7 @@ class StdBitsetPrinter:
|
|||
tsize = wtype.target ().sizeof
|
||||
else:
|
||||
words = [words]
|
||||
tsize = wtype.sizeof
|
||||
tsize = wtype.sizeof
|
||||
|
||||
nwords = wtype.sizeof / tsize
|
||||
result = []
|
||||
|
@ -848,7 +854,7 @@ class Tr1HashtableIterator(Iterator):
|
|||
self.node = self.buckets[self.bucket]
|
||||
if self.node:
|
||||
break
|
||||
self.bucket = self.bucket + 1
|
||||
self.bucket = self.bucket + 1
|
||||
|
||||
def __iter__ (self):
|
||||
return self
|
||||
|
@ -951,7 +957,6 @@ class Tr1UnorderedMapPrinter:
|
|||
data = self.flatten (imap (self.format_one, StdHashtableIterator (self.hashtable())))
|
||||
# Zip the two iterators together.
|
||||
return izip (counter, data)
|
||||
|
||||
|
||||
def display_hint (self):
|
||||
return 'map'
|
||||
|
|
|
@ -41,6 +41,10 @@ main()
|
|||
std::string str = "zardoz";
|
||||
// { dg-final { note-test str "\"zardoz\"" } }
|
||||
|
||||
// PR 65229
|
||||
std::bitset<0> bs0;
|
||||
// { dg-final { note-test bs0 {std::bitset} } }
|
||||
|
||||
std::bitset<10> bs;
|
||||
bs[0] = 1;
|
||||
bs[5] = 1;
|
||||
|
|
Loading…
Reference in New Issue