when we're in an Objective-C container context. Fixes
<rdar://problem/
11286701>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155836
91177308-0d34-0410-b5e6-
96231b3b80d8
Decl *Dcl = HandleDeclarator(S, D, MultiTemplateParamsArg(*this));
if (OriginalLexicalContext && OriginalLexicalContext->isObjCContainer() &&
- Dcl->getDeclContext()->isFileContext())
+ Dcl && Dcl->getDeclContext()->isFileContext())
Dcl->setTopLevelDeclInObjCContainer();
return Dcl;
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+// <rdar://problem/11286701>
+namespace std {
+ template<typename T, typename U> class pair;
+}
+
+@interface NSObject
+@end
+
+@interface Test : NSObject
+@end
+
+@implementation Test
+
+struct EvilStruct {
+} // note the missing semicolon
+
+ typedef std::pair<int, int> IntegerPair; // expected-error{{typedef declarator cannot be qualified}} \
+// expected-error{{typedef name must be an identifier}} \
+// expected-error{{expected ';' after top level declarator}}
+
+@end