Files
clang-p2996/clang/test/Parser/colon-colon-parentheses.cpp
Alejandro Álvarez Ayllón 4bd81c5738 [Clang] Fix eager skipping in ParseExpressionList() (#110133)
i.e., in a call like `function(new Unknown);` the parser should skip only until the
semicolon.

Before this change, everything was skipped until a balanced closing
parenthesis or brace was found. This strategy can cause completely bogus
ASTs. For instance, in the case of the test `new-unknown-type.cpp`,
`struct Bar` would end nested under the namespace `a::b`.
2024-10-02 01:54:29 +02:00

37 lines
1.3 KiB
C++

// RUN: %clang_cc1 %s -verify -fno-spell-checking
struct S { static int a,b,c;};
int S::(a); // expected-error{{expected unqualified-id}}
int S::(b; // expected-error{{expected unqualified-id}}
);
int S::c;
int S::(*d); // expected-error{{expected unqualified-id}}
int S::(*e; // expected-error{{expected unqualified-id}}
);
int S::*f;
int g = S::(a); // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'a'}}
int h = S::(b; // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'b'}}
); // expected-error {{expected unqualified-id}}
int i = S::c;
void foo() {
int a;
a = ::(g); // expected-error{{expected unqualified-id}}
a = ::(h; // expected-error{{expected unqualified-id}}
a = ::i;
}
// The following tests used to be crash bugs.
// PR21815
// expected-error@+2{{a type specifier is required for all declarations}}
// expected-error@+1{{expected unqualified-id}}
a (::( ));
::((c )); // expected-error{{expected unqualified-id}}
// PR26623
int f1(::(B) p); // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'B'}}
int f2(::S::(C) p); // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'C'}}