Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / localization / locales / locale.global.templates / has_facet.pass.cpp
blob00fc8aea10225827471c4a066f34ceb6c11cd3b2
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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <locale>
11 // template <class Facet> bool has_facet(const locale& loc) throw();
13 #include <locale>
14 #include <cassert>
16 #include "test_macros.h"
18 struct my_facet
19 : public std::locale::facet
21 static std::locale::id id;
24 std::locale::id my_facet::id;
26 int main(int, char**)
28 std::locale loc;
29 assert(std::has_facet<std::ctype<char> >(loc));
30 assert(!std::has_facet<my_facet>(loc));
31 std::locale loc2(loc, new my_facet);
32 assert(std::has_facet<my_facet>(loc2));
34 return 0;