(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c2x-attr-deprecated-2.c
       1  /* Test C2x deprecated attribute: invalid contexts.  */
       2  /* { dg-do compile } */
       3  /* { dg-options "-std=c2x -pedantic-errors" } */
       4  
       5  /* This attribute is not valid in most cases on types other than their
       6     definitions, or on labels, or on statements, or as an
       7     attribute-declaration.  */
       8  
       9  [[deprecated]]; /* { dg-error "ignored" } */
      10  
      11  int [[deprecated]] var; /* { dg-error "ignored" } */
      12  
      13  int array_with_dep_type[2] [[deprecated]]; /* { dg-error "ignored" } */
      14  
      15  void fn_with_dep_type () [[deprecated]]; /* { dg-error "ignored" } */
      16  
      17  int z = sizeof (int [[__deprecated__]]); /* { dg-error "ignored" } */
      18  
      19  void
      20  f (void)
      21  {
      22    int a;
      23    [[deprecated]]; /* { dg-error "ignored" } */
      24    [[deprecated]] a = 1; /* { dg-error "ignored" } */
      25    [[deprecated]] label: ; /* { dg-error "ignored" } */
      26    switch (var)
      27      {
      28      [[deprecated]] case 1: ; /* { dg-error "ignored" } */
      29      [[deprecated]] default: ; /* { dg-error "ignored" } */
      30      }
      31  }