TemplateParamContext,// Within a template parameter list.
CXXNewContext, // C++ new-expression.
CXXCatchContext, // C++ catch exception-declaration
+ ObjCCatchContext, // Objective-C catch exception-declaration
BlockLiteralContext, // Block literal declarator.
TemplateTypeArgContext, // Template type argument.
AliasDeclContext, // C++0x alias-declaration.
case TemplateParamContext:
case CXXNewContext:
case CXXCatchContext:
+ case ObjCCatchContext:
case BlockLiteralContext:
case TemplateTypeArgContext:
return true;
case PrototypeContext:
case TemplateParamContext:
case CXXCatchContext:
+ case ObjCCatchContext:
return true;
case TypeNameContext:
case ObjCPrototypeContext:
case TemplateParamContext:
case CXXCatchContext:
+ case ObjCCatchContext:
case TypeNameContext:
case CXXNewContext:
case AliasDeclContext:
if (Tok.isNot(tok::ellipsis)) {
DeclSpec DS(AttrFactory);
ParseDeclarationSpecifiers(DS);
- // For some odd reason, the name of the exception variable is
- // optional. As a result, we need to use "PrototypeContext", because
- // we must accept either 'declarator' or 'abstract-declarator' here.
- Declarator ParmDecl(DS, Declarator::PrototypeContext);
+ Declarator ParmDecl(DS, Declarator::ObjCCatchContext);
ParseDeclarator(ParmDecl);
// Inform the actions module about the declarator, so it
}
break;
case Declarator::CXXCatchContext:
+ case Declarator::ObjCCatchContext:
Error = 4; // Exception declaration
break;
case Declarator::TemplateParamContext:
case Declarator::ForContext:
case Declarator::ConditionContext:
case Declarator::CXXCatchContext:
+ case Declarator::ObjCCatchContext:
case Declarator::BlockLiteralContext:
case Declarator::TemplateTypeArgContext:
// FIXME: We may want to allow parameter packs in block-literal contexts
case Declarator::TemplateParamContext:
case Declarator::CXXNewContext:
case Declarator::CXXCatchContext:
+ case Declarator::ObjCCatchContext:
case Declarator::TemplateTypeArgContext:
Diag(OwnedTagDecl->getLocation(),diag::err_type_defined_in_type_specifier)
<< Context.getTypeDeclType(OwnedTagDecl);
-// RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks %s
+// RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -fobjc-exceptions %s
// "Move" semantics, trivial version.
void move_it(__strong id &&from) {
for (auto x : array) {
__strong id *xPtr = &x;
}
+
+ @try {
+ } @catch (auto e) { // expected-error {{'auto' not allowed in exception declaration}}
+ }
}