(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c2x-complit-8.c
       1  /* Test C2x storage class specifiers in compound literals: inline function
       2     constraints.  */
       3  /* { dg-do compile } */
       4  /* { dg-options "-std=c2x -pedantic-errors" } */
       5  
       6  inline void
       7  f1 ()
       8  {
       9    (static int) { 123 }; /* { dg-error "static but declared in inline function 'f1' which is not static" } */
      10    (static thread_local int) { 456 } ; /* { dg-error "static but declared in inline function 'f1' which is not static" } */
      11    (int) { 789 };
      12    (register int) { 1234 };
      13  }
      14  
      15  inline void
      16  f1e ()
      17  {
      18    (static int) { 123 };
      19    (static thread_local int) { 456 } ;
      20  }
      21  
      22  static inline void
      23  f1s ()
      24  {
      25    (static int) { 123 };
      26    (static thread_local int) { 456 } ;
      27  }
      28  
      29  inline void
      30  f2 ()
      31  {
      32    (static const int) { 123 };
      33    (static thread_local const int) { 456 };
      34  }
      35  
      36  inline void
      37  f2e ()
      38  {
      39    (static const int) { 123 };
      40    (static thread_local const int) { 456 };
      41  }
      42  
      43  static inline void
      44  f2s ()
      45  {
      46    (static const int) { 123 };
      47    (static thread_local const int) { 456 };
      48  }
      49  
      50  inline void
      51  f3 ()
      52  {
      53    (static constexpr int) { 123 };
      54  }
      55  
      56  inline void
      57  f3e ()
      58  {
      59    (static constexpr int) { 123 };
      60  }
      61  
      62  static inline void
      63  f3s ()
      64  {
      65    (static constexpr int) { 123 };
      66  }
      67  
      68  extern void f1e ();
      69  extern void f2e ();
      70  extern void f3e ();