• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
2  struct __attribute__((warn_unused)) Test {
3    Test();
4    ~Test();
5    void use();
6  };
7  
8  struct TestNormal {
9    TestNormal();
10  };
11  
main(void)12  int 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 struct, union or class}}
19    return i;
20  }
21