// { dg-options "-std=gnu++17" } // { dg-do compile { target c++17 } } #include #include #include using __gnu_test::SimpleAllocator; using value_type = std::multimap::value_type; static_assert(std::is_same_v< decltype(std::multimap{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}}, std::less{}, {}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, std::less{}, {}}), std::multimap>); /* This is not deducible, {} could be deduced as _Compare or _Allocator. static_assert(std::is_same_v< decltype(std::multimap{{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}}), std::multimap>); */ static_assert(std::is_same_v< decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}, SimpleAllocator{}}), std::multimap, SimpleAllocator>>); static_assert(std::is_same_v< decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}, SimpleAllocator{}}), std::multimap, SimpleAllocator>>); void f() { std::multimap x; static_assert(std::is_same_v< decltype(std::multimap(x.begin(), x.end())), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), std::less{}, std::allocator{}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), std::less{}, {}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap(x.begin(), x.end(), {})), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), {}, std::allocator{}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), {}, SimpleAllocator{}}), std::multimap, SimpleAllocator>>); } using __gnu_test::test_container; using __gnu_test::input_iterator_wrapper; void g() { value_type array[1]; test_container x(array); static_assert(std::is_same_v< decltype(std::multimap(x.begin(), x.end())), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), std::less{}, std::allocator{}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), std::less{}, {}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap(x.begin(), x.end(), {})), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), {}, std::allocator{}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), {}, SimpleAllocator{}}), std::multimap, SimpleAllocator>>); } void h() { std::pair array[1]; test_container, input_iterator_wrapper> x(array); static_assert(std::is_same_v< decltype(std::multimap(x.begin(), x.end())), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), std::less{}, std::allocator{}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), std::less{}, {}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap(x.begin(), x.end(), {})), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), {}, std::allocator{}}), std::multimap>); static_assert(std::is_same_v< decltype(std::multimap{x.begin(), x.end(), {}, SimpleAllocator{}}), std::multimap, SimpleAllocator>>); }