37 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: clang-modules-build10 11// Prevent <ext/hash_map> from generating deprecated warnings for this test.12// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated13 14#include <ext/hash_map>15#include <cassert>16 17#include "test_macros.h"18#include "count_new.h"19 20void test_default_does_not_allocate() {21 DisableAllocationGuard g;22 ((void)g);23 {24 __gnu_cxx::hash_map<int, int> h;25 assert(h.bucket_count() == 0);26 }27 {28 __gnu_cxx::hash_multimap<int, int> h;29 assert(h.bucket_count() == 0);30 }31}32 33int main(int, char**) {34 test_default_does_not_allocate();35 return 0;36}37