Shafik Yaghmour 6eadc8f16e [Clang] Fix crash in Parser::ParseDirectDeclarator by adding check that token is not an annotation token
In Parser::ParseDirectDeclarator(...) in some cases ill-formed code can cause an
annotation token to end up where it was not expected. The fix is to add a
!Tok.isAnnotation() guard before attempting to access identifier info.

This fixes: https://github.com/llvm/llvm-project/issues/64836

Differential Revision: https://reviews.llvm.org/D158804
2023-09-12 11:06:06 -07:00

13 lines
466 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify -xobjective-c++-header %s
template <typename, typename>
class C {};
class B {
p // expected-error {{unknown type name 'p'}}
private: // expected-error {{'private' is a keyword in Objective-C++}}
void f() {} // expected-error {{expected '(' for function-style cast or type construction}}
C<int, decltype(f)> c; // expected-error {{use of undeclared identifier 'f'}}
// expected-error@-1 {{expected member name}}
};