// when declaring a replaceable global allocation function.
DiagID = diag::ext_missing_exception_specification;
ReturnValueOnError = false;
+ } else if (ESI.Type == EST_NoThrow) {
+ // Allow missing attribute 'nothrow' in redeclarations, since this is a very
+ // common omission.
+ DiagID = diag::ext_missing_exception_specification;
+ ReturnValueOnError = false;
} else {
DiagID = diag::err_missing_exception_specification;
ReturnValueOnError = true;
OldProto->getNoexceptExpr()->printPretty(OS, nullptr, getPrintingPolicy());
OS << ")";
break;
-
+ case EST_NoThrow:
+ OS <<"__attribute__((nothrow))";
+ break;
default:
llvm_unreachable("This spec type is compatible with none.");
}
delete a;
}
+namespace PR42089 {
+ struct S {
+ __attribute__((nothrow)) void Foo(); // expected-note {{previous declaration is here}}
+ __attribute__((nothrow)) void Bar();
+ };
+ void S::Foo(){} // expected-warning {{is missing exception specification}}
+ __attribute__((nothrow)) void S::Bar(){}
+}
+
#elif TEST2
// Check that __unaligned is not recognized if MS extensions are not enabled