mirror of git://gcc.gnu.org/git/gcc.git
cxx11.cc (struct datum): New.
* testsuite/libstdc++-prettyprinters/cxx11.cc (struct datum): New. (global): New global. (main): Add test for unique_ptr. * python/libstdcxx/v6/printers.py (UniquePointerPrinter.to_string): Extract the pointer and also print its type. From-SVN: r190417
This commit is contained in:
parent
5dfe1ad496
commit
c4269a634c
|
|
@ -1,3 +1,13 @@
|
||||||
|
2012-08-15 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* testsuite/libstdc++-prettyprinters/cxx11.cc (struct datum):
|
||||||
|
New.
|
||||||
|
(global): New global.
|
||||||
|
(main): Add test for unique_ptr.
|
||||||
|
* python/libstdcxx/v6/printers.py
|
||||||
|
(UniquePointerPrinter.to_string): Extract the pointer and also
|
||||||
|
print its type.
|
||||||
|
|
||||||
2012-08-13 David Adler <d.adler.s@gmail.com>
|
2012-08-13 David Adler <d.adler.s@gmail.com>
|
||||||
|
|
||||||
PR libstdc++/54185
|
PR libstdc++/54185
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,9 @@ class UniquePointerPrinter:
|
||||||
self.val = val
|
self.val = val
|
||||||
|
|
||||||
def to_string (self):
|
def to_string (self):
|
||||||
return self.val['_M_t']
|
v = self.val['_M_t']['_M_head_impl']
|
||||||
|
return ('std::unique_ptr<%s> containing %s' % (str(v.type.target()),
|
||||||
|
str(v)))
|
||||||
|
|
||||||
class StdListPrinter:
|
class StdListPrinter:
|
||||||
"Print a std::list"
|
"Print a std::list"
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,14 @@ use(const T &container)
|
||||||
placeholder(*i);
|
placeholder(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct datum
|
||||||
|
{
|
||||||
|
std::string s;
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<datum> global;
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
|
@ -86,6 +94,11 @@ main()
|
||||||
uoms.insert(5);
|
uoms.insert(5);
|
||||||
// { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
|
// { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
|
||||||
|
|
||||||
|
std::unique_ptr<datum> uptr (new datum);
|
||||||
|
uptr->s = "hi bob";
|
||||||
|
uptr->i = 23;
|
||||||
|
// { dg-final { regexp-test uptr {std::unique_ptr.datum. containing 0x.*} } }
|
||||||
|
|
||||||
placeholder(""); // Mark SPOT
|
placeholder(""); // Mark SPOT
|
||||||
use(efl);
|
use(efl);
|
||||||
use(fl);
|
use(fl);
|
||||||
|
|
@ -93,6 +106,8 @@ main()
|
||||||
use(eumm);
|
use(eumm);
|
||||||
use(eus);
|
use(eus);
|
||||||
use(eums);
|
use(eums);
|
||||||
|
use(uoms);
|
||||||
|
use(uptr->s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue