libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

test_poisoned_hash_helper.pass.cpp (1166B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // Test that the header `poisoned_hash_helper.hpp` doesn't include any
     13 // headers that provide hash<T> specializations. This is required so that the
     14 // 'test_library_hash_specializations_available()' function returns false
     15 // by default, unless a STL header providing hash has already been included.
     16 
     17 #include "poisoned_hash_helper.hpp"
     18 
     19 template <class T, size_t = sizeof(T)>
     20 constexpr bool is_complete_imp(int) { return true; }
     21 template <class> constexpr bool is_complete_imp(long) { return false; }
     22 template <class T> constexpr bool is_complete() { return is_complete_imp<T>(0); }
     23 
     24 template <class T> struct has_complete_hash {
     25   enum { value = is_complete<std::hash<T> >() };
     26 };
     27 
     28 int main() {
     29   static_assert(LibraryHashTypes::assertTrait<has_complete_hash, false>(), "");
     30 }