diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-10-31 12:58:45 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-10-31 12:58:45 +0000 |
commit | d5e33619bf7766bcd1419da6d32780199db8df86 (patch) | |
tree | 3ac38f11e94ba8e66d04c275f3c60048dd01544d | |
parent | 8e82c473f504c32c840daf09a347795b62b46fa3 (diff) | |
download | gcc-d5e33619bf7766bcd1419da6d32780199db8df86.zip gcc-d5e33619bf7766bcd1419da6d32780199db8df86.tar.gz gcc-d5e33619bf7766bcd1419da6d32780199db8df86.tar.bz2 |
More testing for std::pair layout change
* testsuite/20_util/pair/87822.cc: Test deeper nesting.
From-SVN: r265680
-rw-r--r-- | libstdc++-v3/ChangeLog | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/20_util/pair/87822.cc | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ac4df1a..9fb18de 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,7 @@ 2018-10-31 Jonathan Wakely <jwakely@redhat.com> + * testsuite/20_util/pair/87822.cc: Test deeper nesting. + PR libstdc++/87822 * include/bits/stl_pair.h (__pair_base): Change to class template. (pair): Make base class type depend on template parameters. diff --git a/libstdc++-v3/testsuite/20_util/pair/87822.cc b/libstdc++-v3/testsuite/20_util/pair/87822.cc index cd099d6..523d583 100644 --- a/libstdc++-v3/testsuite/20_util/pair/87822.cc +++ b/libstdc++-v3/testsuite/20_util/pair/87822.cc @@ -26,6 +26,7 @@ test01() static_assert(sizeof(p) == (3 * sizeof(int)), "PR libstdc++/87822"); #endif VERIFY( (void*)&p == (void*)&p.first ); + VERIFY( (void*)&p == (void*)&p.first.first ); } struct empty { }; @@ -40,8 +41,24 @@ test02() VERIFY( (void*)&p == (void*)&p.first ); } +void +test03() +{ + typedef std::pair<int, int> int_pair; + typedef std::pair<int_pair, int_pair> int_pair_pair; + std::pair<int_pair_pair, int_pair_pair> p; +#if __cplusplus >= 201103L + static_assert(sizeof(int_pair_pair) == (2 * sizeof(int_pair)), "nested"); + static_assert(sizeof(p) == (2 * sizeof(int_pair_pair)), "nested again"); +#endif + VERIFY( (void*)&p == (void*)&p.first ); + VERIFY( (void*)&p == (void*)&p.first.first ); + VERIFY( (void*)&p == (void*)&p.first.first.first ); +} + int main() { test01(); test02(); + test03(); } |