(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c2x-nullptr-6.c
       1  /* PR c/108424 */
       2  /* { dg-options "-std=c2x" } */
       3  
       4  struct S {
       5    int i;
       6    int : nullptr; /* { dg-error "not an integer constant" } */
       7  };
       8  
       9  enum E { X = nullptr }; /* { dg-error "not an integer constant" } */
      10  
      11  alignas(nullptr) int g; /* { dg-error "not an integer constant" } */
      12  
      13  int arr[10] = { [nullptr] = 1 }; /* { dg-error "not of integer type" } */
      14  
      15  _Static_assert (nullptr, "nullptr"); /* { dg-error "not an integer" } */
      16  
      17  void f (int n)
      18  {
      19    switch (n) {
      20    case nullptr: /* { dg-error "an integer constant" } */
      21    default:
      22    }
      23  
      24    switch (n) {
      25    case 1 ... nullptr: /* { dg-error "an integer constant" } */
      26    default:
      27    }
      28  
      29    switch (n) {
      30    case nullptr ... 2: /* { dg-error "an integer constant" } */
      31    default:
      32    }
      33  }