public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
@ 2015-11-16 21:04 Doug Evans
  2015-11-16 21:24 ` Jonathan Wakely
  2015-11-25 17:32 ` Alan Lawrence
  0 siblings, 2 replies; 8+ messages in thread
From: Doug Evans @ 2015-11-16 21:04 UTC (permalink / raw)
  To: gcc-patches, libstdc++

Hi.

Apologies for the delay.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440

Tested with current trunk.

2015-11-16  Doug Evans  <dje@google.com>

	PR libstdc++/67440
	* python/libstdcxx/v6/printers.py (find_type): Handle "const" in
	type name.
	* testsuite/libstdc++-prettyprinters/debug.cc: Add test for
	const set<int>.
	* testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.

Index: python/libstdcxx/v6/printers.py
===================================================================
--- python/libstdcxx/v6/printers.py	(revision 227421)
+++ python/libstdcxx/v6/printers.py	(working copy)
@@ -85,7 +85,9 @@
  def find_type(orig, name):
      typ = orig.strip_typedefs()
      while True:
-        search = str(typ) + '::' + name
+        # Use typ.name here instead of str(typ) to discard any const,etc.
+        # qualifiers.  PR 67440.
+        search = typ.name + '::' + name
          try:
              return gdb.lookup_type(search)
          except RuntimeError:
Index: testsuite/libstdc++-prettyprinters/debug.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/debug.cc	(revision 227421)
+++ testsuite/libstdc++-prettyprinters/debug.cc	(working copy)
@@ -70,6 +70,10 @@
    std::map<std::string, int>::iterator mpiter = mp.begin();
  // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }

+  // PR 67440
+  const std::set<int> const_intset = {2, 3};
+// { dg-final { note-test const_intset {std::__debug::set with 2 elements  
= {[0] = 2, [1] = 3}} } }
+
    std::set<std::string> sp;
    sp.insert("clownfish");
    sp.insert("barrel");
Index: testsuite/libstdc++-prettyprinters/simple.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/simple.cc	(revision 227421)
+++ testsuite/libstdc++-prettyprinters/simple.cc	(working copy)
@@ -73,6 +73,10 @@
    std::map<std::string, int>::iterator mpiter = mp.begin();
  // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }

+  // PR 67440
+  const std::set<int> const_intset = {2, 3};
+// { dg-final { note-test const_intset {std::set with 2 elements = {[0] =  
2, [1] = 3}} } }
+
    std::set<std::string> sp;
    sp.insert("clownfish");
    sp.insert("barrel");
Index: testsuite/libstdc++-prettyprinters/simple11.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/simple11.cc	(revision 227421)
+++ testsuite/libstdc++-prettyprinters/simple11.cc	(working copy)
@@ -73,6 +73,10 @@
    std::map<std::string, int>::iterator mpiter = mp.begin();
  // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }

+  // PR 67440
+  const std::set<int> const_intset = {2, 3};
+// { dg-final { note-test const_intset {std::set with 2 elements = {[0] =  
2, [1] = 3}} } }
+
    std::set<std::string> sp;
    sp.insert("clownfish");
    sp.insert("barrel");

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-26 16:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 21:04 [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails Doug Evans
2015-11-16 21:24 ` Jonathan Wakely
2015-11-25 17:32 ` Alan Lawrence
2015-11-25 18:57   ` Doug Evans
2015-11-25 19:59   ` Jonathan Wakely
2015-11-26 15:55     ` Jonathan Wakely
2015-11-26 16:10       ` Jonathan Wakely
2015-11-26 16:36         ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).