1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s 2*0a6a1f1dSLionel Sambuc struct __attribute__((warn_unused)) Test { 3f4a2713aSLionel Sambuc Test(); 4f4a2713aSLionel Sambuc ~Test(); 5f4a2713aSLionel Sambuc void use(); 6f4a2713aSLionel Sambuc }; 7f4a2713aSLionel Sambuc 8*0a6a1f1dSLionel Sambuc struct TestNormal { 9f4a2713aSLionel Sambuc TestNormal(); 10f4a2713aSLionel Sambuc }; 11f4a2713aSLionel Sambuc main(void)12*0a6a1f1dSLionel Sambucint main(void) { 13f4a2713aSLionel Sambuc Test unused; // expected-warning {{unused variable 'unused'}} 14f4a2713aSLionel Sambuc Test used; 15f4a2713aSLionel Sambuc TestNormal normal; 16f4a2713aSLionel Sambuc used.use(); 17*0a6a1f1dSLionel Sambuc 18*0a6a1f1dSLionel Sambuc int i __attribute__((warn_unused)) = 12; // expected-warning {{'warn_unused' attribute only applies to struct, union or class}} 19*0a6a1f1dSLionel Sambuc return i; 20f4a2713aSLionel Sambuc } 21