Fix pretty-printer for std::variant
authorJonathan Wakely <jwakely@redhat.com>
Tue, 6 Dec 2016 14:36:07 +0000 (14:36 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 6 Dec 2016 14:36:07 +0000 (14:36 +0000)
* python/libstdcxx/v6/printers.py (StdVariantPrinter): Update for new
data member name.
* testsuite/libstdc++-prettyprinters/cxx17.cc: Remove redundant test.

From-SVN: r243304

libstdc++-v3/ChangeLog
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc

index 676d32b2722e68f93685ec5d17686373061943f5..5662809166698b0e845157f187c5531270f6f0d2 100644 (file)
@@ -1,5 +1,9 @@
 2016-12-06  Jonathan Wakely  <jwakely@redhat.com>
 
+       * python/libstdcxx/v6/printers.py (StdVariantPrinter): Update for new
+       data member name.
+       * testsuite/libstdc++-prettyprinters/cxx17.cc: Remove redundant test.
+
        * include/bits/shared_ptr_base.h
        (__shared_ptr_access<T, L, false, true>::operator->()): Fix assertion.
 
index bad42b472a90e3b8aa05132dcc585146022bae37..ff428e8f7e9a93fc501af24f7ffaa8cdaa01b787 100644 (file)
@@ -1002,7 +1002,7 @@ class StdVariantPrinter(SingleObjContainerPrinter):
             visualizer = None
         else:
             self.contained_type = alternatives[int(self.index)]
-            addr = val['_M_union']['_M_first']['_M_storage'].address
+            addr = val['_M_u']['_M_first']['_M_storage'].address
             contained_value = addr.cast(self.contained_type.pointer()).dereference()
             visualizer = gdb.default_visualizer(contained_value)
         super (StdVariantPrinter, self).__init__(contained_value, visualizer, 'array')
index 96be8c7923536cbd58a46ad1879a9bf0cd779eae..69c16c10e9107c26c4affa824cce3b61303b0059 100644 (file)
@@ -86,8 +86,6 @@ main()
 // { dg-final { note-test v3 {std::variant<float, int, std::string_view> [index 1] = {3}} } }
   variant<float, int, string_view> v4{ str };
 // { dg-final { note-test v4 {std::variant<float, int, std::string_view> [index 2] = {"string"}} } }
-  variant<string_view> vref{str};
-// { dg-final { note-test vref {std::variant<std::string_view> [index 0] = {"string"}} } }
 
   map<int, string_view> m{ {1, "one"} };
   map<int, string_view>::node_type n0;