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.
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 { };
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();
}