1 2 //===----------------------------------------------------------------------===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is dual licensed under the MIT and the University of Illinois Open 7 // Source Licenses. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 11 // UNSUPPORTED: c++98, c++03 12 13 // <experimental/filesystem> 14 15 // class path 16 17 // operator string_type() const; 18 19 #include <experimental/filesystem> 20 #include <type_traits> 21 #include <cassert> 22 23 #include "test_macros.h" 24 #include "filesystem_test_helper.hpp" 25 26 namespace fs = std::experimental::filesystem; 27 28 int main() 29 { 30 using namespace fs; 31 using string_type = path::string_type; 32 const char* const value = "hello world"; 33 { // Check signature 34 path p(value); 35 static_assert(std::is_convertible<path, string_type>::value, ""); 36 static_assert(std::is_constructible<string_type, path>::value, ""); 37 ASSERT_SAME_TYPE(string_type, decltype(p.operator string_type())); 38 ASSERT_NOT_NOEXCEPT(p.operator string_type()); 39 } 40 { 41 path p(value); 42 assert(p.native() == value); 43 string_type s = p; 44 assert(s == value); 45 assert(p == value); 46 } 47 } 48