Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion clang/lib/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2222,8 +2222,15 @@ bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(
}
}

if (SS.isEmpty())
if (SS.isEmpty()) {
if (getLangOpts().ObjC && !getLangOpts().CPlusPlus &&
Tok.is(tok::coloncolon)) {
// ObjectiveC does not allow :: as as a scope token.
Diag(ConsumeToken(), diag::err_expected_type);
return true;
}
return false;
}

// A C++ scope specifier that isn't followed by a typename.
AnnotateScopeToken(SS, IsNewScope);
Expand Down
5 changes: 5 additions & 0 deletions clang/test/Parser/objc-coloncolon.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %clang_cc1 -x objective-c -fsyntax-only -verify %s

@interface A
- (instancetype)init:(::A *) foo; // expected-error {{expected a type}}
@end
Loading