forked from OSchip/llvm-project
Fix PR 19630, don't crash when file ends with whitespace.
llvm-svn: 207883
This commit is contained in:
parent
b2faa59976
commit
a1342406f2
|
@ -4834,7 +4834,8 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
|
|||
LLVM_BUILTIN_TRAP;
|
||||
if (D.getContext() == Declarator::MemberContext)
|
||||
Diag(Tok, diag::err_expected_member_name_or_semi)
|
||||
<< D.getDeclSpec().getSourceRange();
|
||||
<< (D.getDeclSpec().isEmpty() ? SourceRange()
|
||||
: D.getDeclSpec().getSourceRange());
|
||||
else if (getLangOpts().CPlusPlus) {
|
||||
if (Tok.is(tok::period) || Tok.is(tok::arrow))
|
||||
Diag(Tok, diag::err_invalid_operator_on_type) << Tok.is(tok::arrow);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: expected member name or ';' after declaration specifiers
|
||||
// CHECK: error: expected '}'
|
||||
// CHECK: note: to match this '{'
|
||||
// CHECK: error: expected ';' after class
|
||||
// CHECK: error: anonymous structs and classes must be class members
|
||||
// CHECK: 4 errors generated.
|
||||
|
||||
// Do not add anything to the end of this file. This requires the whitespace
|
||||
// plus EOF after the template keyword.
|
||||
|
||||
class { template
|
Loading…
Reference in New Issue