This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/48362] New: pretty printer fails for zero-size std::tuple<>
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Mar 2011 11:49:59 +0000
- Subject: [Bug libstdc++/48362] New: pretty printer fails for zero-size std::tuple<>
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48362
Summary: pretty printer fails for zero-size std::tuple<>
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
CC: tromey@gcc.gnu.org
trying to print a std::tuple<> fails
(gdb) ptype t
type = class std::tuple<> {
public:
void swap(std::tuple<> &);
}
(gdb) p t
$1 = std::tuple containingTraceback (most recent call last):
File
"/home/wakelj/tools/Linux-x86_64/test/share/gcc-4.6.0/python/libstdcxx/v6/printers.py",
line 290, in children
return self._iterator (self.val)
File
"/home/wakelj/tools/Linux-x86_64/test/share/gcc-4.6.0/python/libstdcxx/v6/printers.py",
line 248, in __init__
raise ValueError, "Top of tuple tree does not consist of a single node."
ValueError: Top of tuple tree does not consist of a single node.
The following patch is a quick hack to prevent the error, but produces the
unhelpful output:
(gdb) p t
$1 = std::tuple containing
(gdb)
--- python/libstdcxx/v6/printers.py.orig 2011-03-30 11:44:33.786660891
+0000
+++ python/libstdcxx/v6/printers.py 2011-03-30 11:46:33.570222630 +0000
@@ -244,6 +244,10 @@
# Set the base class as the initial head of the
# tuple.
nodes = self.head.type.fields ()
+ if len (nodes) == 0:
+ self.count = -1
+ return
+
if len (nodes) != 1:
raise ValueError, "Top of tuple tree does not consist of a
single node."
@@ -255,6 +259,8 @@
return self
def next (self):
+ if self.count == -1:
+ raise StopIteration
nodes = self.head.type.fields ()
# Check for further recursions in the inheritance tree.
if len (nodes) == 0: