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 //===----------------------------------------------------------------------===//
8
9 // Test that _LIBCPP_NODISCARD_EXT is not defined to [[nodiscard]] when
10 // _LIBCPP_DISABLE_NODISCARD_EXT is defined
11
12 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT
13
14 #include <__config>
15
foo()16 _LIBCPP_NODISCARD_EXT int foo() { return 42; }
17
main(int,char **)18 int main(int, char**) {
19 foo(); // OK.
20
21 return 0;
22 }
23