Home | History | Annotate | Download | only in dcl.attr.nodiscard
      1 // RUN: %clang_cc1 -std=c++1z -verify %s
      2 
      3 namespace std_example {
      4   struct [[nodiscard]] error_info{
      5     // ...
      6   };
      7 
      8   error_info enable_missile_safety_mode();
      9   void launch_missiles();
     10   void test_missiles() {
     11     enable_missile_safety_mode(); // expected-warning {{ignoring return value of function declared with 'nodiscard'}}
     12     launch_missiles();
     13   }
     14 
     15   error_info &foo();
     16   void f() { foo(); } // no warning
     17 }
     18