libcxx

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

nodiscard_aftercxx17.pass.cpp (724B)


      1 // -*- C++ -*-
      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 // Test that _LIBCPP_NODISCARD_AFTER_CXX17 is disabled whenever
     12 // _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 is defined by the user.
     13 
     14 // MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
     15 #define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
     16 #include <__config>
     17 
     18 _LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
     19 
     20 int main ()
     21 {
     22 	foo();	// no error here!
     23 }