aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2011-12-22 12:33:15 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2011-12-22 12:33:15 +0000
commit9dacb44bf10a5151a0d0e1a2a22865ed00575d40 (patch)
treed7291e3d4d1965db44c60d0a07ed5d63765e5d8e /libstdc++-v3
parent2d1debf816aec77401023e308a136288d42c7237 (diff)
downloadgcc-9dacb44bf10a5151a0d0e1a2a22865ed00575d40.zip
gcc-9dacb44bf10a5151a0d0e1a2a22865ed00575d40.tar.gz
gcc-9dacb44bf10a5151a0d0e1a2a22865ed00575d40.tar.bz2
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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py10
2 files changed, 12 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8775d0a..687a1d4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 241ae04..4197c08 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -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: