40 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// <locale>10 11// template <class Facet> const Facet& use_facet(const locale& loc);12 13// REQUIRES: no-exceptions14 15// Make sure we abort() when we pass a facet not associated to the locale to16// use_facet() and exceptions are disabled.17 18#include <csignal>19#include <cstdlib>20#include <locale>21 22#include "test_macros.h"23 24 25struct my_facet : public std::locale::facet {26 static std::locale::id id;27};28 29std::locale::id my_facet::id;30 31void exit_success(int) {32 std::_Exit(EXIT_SUCCESS);33}34 35int main(int, char**) {36 std::signal(SIGABRT, exit_success);37 std::use_facet<my_facet>(std::locale());38 return EXIT_FAILURE;39}40