if (!Method)
return;
- // Dig out the prototype. This should never fail.
+ // Dig out the prototype, looking through only parens. This should never fail.
const FunctionProtoType *Proto
- = dyn_cast<FunctionProtoType>(Method->getType());
- if (!Proto)
- return;
+ = cast<FunctionProtoType>(Method->getType().IgnoreParens());
// Check the exception specification.
llvm::SmallVector<QualType, 4> Exceptions;
Proto->arg_type_begin(),
Proto->getNumArgs(),
EPI);
+
+ // Rebuild any parens around the function type.
+ for (const ParenType *PT = dyn_cast<ParenType>(Method->getType()); PT;
+ PT = dyn_cast<ParenType>(PT->getInnerType()))
+ T = Context.getParenType(T);
+
if (TypeSourceInfo *TSInfo = Method->getTypeSourceInfo()) {
// FIXME: When we get proper type location information for exceptions,
// we'll also have to rebuild the TypeSourceInfo. For now, we just patch
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// C++11 [class.mem]p2:
// A class is considered a completely-defined object type (or
template struct A2<int>;
}
+
+namespace PR12629 {
+ struct S {
+ static int (f)() throw();
+ static int ((((((g))))() throw(int)));
+ };
+ static_assert(noexcept(S::f()), "");
+ static_assert(!noexcept(S::g()), "");
+}