colon-colon-parentheses.cpp 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // RUN: %clang_cc1 %s -fsyntax-only -verify -DPR21815
  2. // RUN: cp %s %t
  3. // RUN: not %clang_cc1 -x c++ -fixit %t
  4. // RUN: %clang_cc1 -x c++ %t
  5. struct S { static int a,b,c;};
  6. int S::(a); // expected-error{{unexpected parenthesis after '::'}}
  7. int S::(b; // expected-error{{unexpected parenthesis after '::'}}
  8. int S::c;
  9. int S::(*d); // expected-error{{unexpected parenthesis after '::'}}
  10. int S::(*e; // expected-error{{unexpected parenthesis after '::'}}
  11. int S::*f;
  12. int g = S::(a); // expected-error{{unexpected parenthesis after '::'}}
  13. int h = S::(b; // expected-error{{unexpected parenthesis after '::'}}
  14. int i = S::c;
  15. void foo() {
  16. int a;
  17. a = ::(g); // expected-error{{unexpected parenthesis after '::'}}
  18. a = ::(h; // expected-error{{unexpected parenthesis after '::'}}
  19. a = ::i;
  20. }
  21. #ifdef PR21815
  22. // expected-error@+4{{C++ requires a type specifier for all declarations}}
  23. // expected-error@+3{{expected unqualified-id}}
  24. // expected-error@+3{{expected expression}}
  25. // expected-error@+1{{expected ';' after top level declarator}}
  26. a (::(
  27. #endif