From 0000fd8cfd4ec4d053a003dc72d50dc8db553d09 Mon Sep 17 00:00:00 2001
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 29 Mar 2017 15:05:50 +0300
Subject: [PATCH] Adjust optional's pretty printer for LWG 2900.

* python/libstdcxx/v6/printers.py (StdExpOptionalPrinter.__init__):
Look at the nested payload in case of non-experimental optional.

From-SVN: r246566
---
 libstdc++-v3/ChangeLog                       | 6 ++++++
 libstdc++-v3/python/libstdcxx/v6/printers.py | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a4cb6b7d6cf4..23ce6d3885b7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-29  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+	Adjust optional's pretty printer for LWG 2900.
+	* python/libstdcxx/v6/printers.py (StdExpOptionalPrinter.__init__):
+	Look at the nested payload in case of non-experimental optional.
+
 2017-03-29  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
 	Implement LWG 2900, The copy and move constructors
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 14025dda2a1b..a67b27ab7368 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1023,6 +1023,8 @@ class StdExpOptionalPrinter(SingleObjContainerPrinter):
         valtype = self._recognize (val.type.template_argument(0))
         self.typename = re.sub('^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3<%s>' % valtype, typename, 1)
         self.typename = strip_versioned_namespace(self.typename)
+        if not self.typename.startswith('std::experimental'):
+            val = val['_M_payload']
         self.val = val
         contained_value = val['_M_payload'] if self.val['_M_engaged'] else None
         visualizer = gdb.default_visualizer (val['_M_payload'])
-- 
GitLab