deref.c 615 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* RUN: %clang_cc1 -fsyntax-only -verify -std=c90 -pedantic %s
  2. */
  3. void
  4. foo (void)
  5. {
  6. struct b;
  7. struct b* x = 0;
  8. struct b* y = &*x;
  9. }
  10. void foo2 (void)
  11. {
  12. typedef int (*arrayptr)[];
  13. arrayptr x = 0;
  14. arrayptr y = &*x;
  15. }
  16. void foo3 (void)
  17. {
  18. void* x = 0;
  19. void* y = &*x; /* expected-warning{{address of an expression of type 'void'}} */
  20. }
  21. extern const void cv1;
  22. const void *foo4 (void)
  23. {
  24. return &cv1;
  25. }
  26. extern void cv2;
  27. void *foo5 (void)
  28. {
  29. return &cv2; /* expected-warning{{address of an expression of type 'void'}} */
  30. }
  31. typedef const void CVT;
  32. extern CVT cv3;
  33. const void *foo6 (void)
  34. {
  35. return &cv3;
  36. }