void_arg.c 832 B

1234567891011121314151617181920212223242526
  1. /* RUN: %clang_cc1 -fsyntax-only %s -verify
  2. */
  3. typedef void Void;
  4. void foo() {
  5. int X;
  6. X = sizeof(int (void a)); // expected-error {{argument may not have 'void' type}}
  7. X = sizeof(int (int, void)); // expected-error {{must be the first and only parameter}}
  8. X = sizeof(int (void, ...)); // expected-error {{must be the first and only parameter}}
  9. X = sizeof(int (Void a)); // expected-error {{argument may not have 'void' type}}
  10. X = sizeof(int (int, Void)); // expected-error {{must be the first and only parameter}}
  11. X = sizeof(int (Void, ...)); // expected-error {{must be the first and only parameter}}
  12. // Accept these.
  13. X = sizeof(int (void));
  14. X = sizeof(int (Void));
  15. }
  16. // this is ok.
  17. void bar(Void) {
  18. }
  19. void f(const void); // expected-error {{parameter must not have type qualifiers}}