xref: /aosp_15_r20/external/clang/test/Parser/colon-colon-parentheses.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -fsyntax-only -verify -DPR21815
2*67e74705SXin Li // RUN: cp %s %t
3*67e74705SXin Li // RUN: not %clang_cc1 -x c++ -fixit %t
4*67e74705SXin Li // RUN: %clang_cc1 -x c++ %t
5*67e74705SXin Li 
6*67e74705SXin Li struct S { static int a,b,c;};
7*67e74705SXin Li int S::(a);  // expected-error{{unexpected parenthesis after '::'}}
8*67e74705SXin Li int S::(b;  // expected-error{{unexpected parenthesis after '::'}}
9*67e74705SXin Li int S::c;
10*67e74705SXin Li int S::(*d);  // expected-error{{unexpected parenthesis after '::'}}
11*67e74705SXin Li int S::(*e;  // expected-error{{unexpected parenthesis after '::'}}
12*67e74705SXin Li int S::*f;
13*67e74705SXin Li int g = S::(a);  // expected-error{{unexpected parenthesis after '::'}}
14*67e74705SXin Li int h = S::(b;  // expected-error{{unexpected parenthesis after '::'}}
15*67e74705SXin Li int i = S::c;
16*67e74705SXin Li 
17*67e74705SXin Li void foo() {
18*67e74705SXin Li   int a;
19*67e74705SXin Li   a = ::(g);  // expected-error{{unexpected parenthesis after '::'}}
20*67e74705SXin Li   a = ::(h;  // expected-error{{unexpected parenthesis after '::'}}
21*67e74705SXin Li   a = ::i;
22*67e74705SXin Li }
23*67e74705SXin Li 
24*67e74705SXin Li #ifdef PR21815
25*67e74705SXin Li // expected-error@+2{{C++ requires a type specifier for all declarations}}
26*67e74705SXin Li // expected-error@+1{{expected unqualified-id}}
27*67e74705SXin Li a (::( ));
28*67e74705SXin Li 
29*67e74705SXin Li ::((c )); // expected-error{{expected unqualified-id}}
30*67e74705SXin Li #endif
31