(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c90-const-expr-10.c
       1  /* Test for constant expressions: invalid null pointer constants in
       2     various contexts (make sure NOPs are not inappropriately
       3     stripped).  */
       4  /* Origin: Joseph Myers <joseph@codesourcery.com> */
       5  /* { dg-do compile } */
       6  /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
       7  
       8  __extension__ typedef __SIZE_TYPE__ size_t;
       9  
      10  void *p = (size_t)(void *)0; /* { dg-error "without a cast" } */
      11  struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
      12  void *
      13  f (void)
      14  {
      15    void *r;
      16    r = (size_t)(void *)0; /* { dg-error "without a cast" } */
      17    return (size_t)(void *)0; /* { dg-error "without a cast" } */
      18  }
      19  void g (void *); /* { dg-message "but argument is of type" } */
      20  void
      21  h (void)
      22  {
      23    g ((size_t)(void *)0); /* { dg-error "without a cast" } */
      24  }
      25  void g2 (int, void *); /* { dg-message "but argument is of type" } */
      26  void
      27  h2 (void)
      28  {
      29    g2 (0, (size_t)(void *)0); /* { dg-error "without a cast" } */
      30  }