Commit 9dacb44b by Jonathan Wakely Committed by Jonathan Wakely

re PR libstdc++/48362 (pretty printer fails for zero-size std::tuple<>)

	PR libstdc++/48362
	* python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle empty
	tuples.

From-SVN: r182620
parent 2d1debf8
2011-12-22 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/48362
* python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle empty
tuples.
2011-12-20 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/51365
......
......@@ -251,11 +251,11 @@ class StdTuplePrinter:
# Set the base class as the initial head of the
# tuple.
nodes = self.head.type.fields ()
if len (nodes) != 1:
if len (nodes) == 1:
# Set the actual head to the first pair.
self.head = self.head.cast (nodes[0].type)
elif len (nodes) != 0:
raise ValueError, "Top of tuple tree does not consist of a single node."
# Set the actual head to the first pair.
self.head = self.head.cast (nodes[0].type)
self.count = 0
def __iter__ (self):
......@@ -297,6 +297,8 @@ class StdTuplePrinter:
return self._iterator (self.val)
def to_string (self):
if len (self.val.type.fields ()) == 0:
return 'empty %s' % (self.typename)
return '%s containing' % (self.typename)
class StdStackOrQueuePrinter:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment