commit 2f135ef76712b96e3dd799dfbb17e8d16545b115
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Dec 6 14:24:13 2016 +0000
Fix pretty-printer for std::variant
* python/libstdcxx/v6/printers.py (StdVariantPrinter): Update for new
data member name.
* testsuite/libstdc++-prettyprinters/cxx17.cc: Remove redundant test.
@@ -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')
@@ -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;