Home | History | Annotate | Download | only in dcl.attr.deprecated
      1 // RUN: %clang_cc1 -std=c++1y -verify %s
      2 
      3 class [[deprecated]] C {}; // expected-note {{'C' has been explicitly marked deprecated here}}
      4 C c; // expected-warning {{'C' is deprecated}}
      5 
      6 typedef int t [[deprecated]]; // expected-note {{'t' has been explicitly marked deprecated here}}
      7 t x = 42; // expected-warning {{'t' is deprecated}}
      8 
      9 [[deprecated]] int old = 42; // expected-note {{'old' has been explicitly marked deprecated here}}
     10 int use = old; // expected-warning {{'old' is deprecated}}
     11 
     12 struct S { [[deprecated]] int member = 42; } s; // expected-note {{'member' has been explicitly marked deprecated here}}
     13 int use2 = s.member; // expected-warning {{'member' is deprecated}}
     14 
     15 [[deprecated]] int f() { return 42; } // expected-note {{'f' has been explicitly marked deprecated here}}
     16 int use3 = f(); // expected-warning {{'f' is deprecated}}
     17 
     18 enum [[deprecated]] e { E }; // expected-note {{'e' has been explicitly marked deprecated here}}
     19 e my_enum; // expected-warning {{'e' is deprecated}}
     20 
     21 template <typename T> class X {};
     22 template <> class [[deprecated]] X<int> {}; // expected-note {{'X<int>' has been explicitly marked deprecated here}}
     23 X<char> x1;
     24 // FIXME: The diagnostic here could be much better by mentioning X<int>.
     25 X<int> x2; // expected-warning {{'X' is deprecated}}
     26 
     27 template <typename T> class [[deprecated]] X2 {};
     28 template <> class X2<int> {};
     29 X2<char> x3; // FIXME: no warning!
     30 X2<int> x4;
     31