21 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s2struct __attribute__((warn_unused)) Test {3 Test();4 ~Test();5 void use();6};7 8struct TestNormal {9 TestNormal();10};11 12int main(void) {13 Test unused; // expected-warning {{unused variable 'unused'}}14 Test used;15 TestNormal normal;16 used.use();17 18 int i __attribute__((warn_unused)) = 12; // expected-warning {{'warn_unused' attribute only applies to structs, unions, and classes}}19 return i;20}21