}
}
- // Ignore differences in calling convention until decl merging.
+ // Ignore differences in calling convention and noreturn until decl
+ // merging.
const FunctionProtoType *TmplFT =
TmplFD->getType()->castAs<FunctionProtoType>();
- if (FPT->getCallConv() != TmplFT->getCallConv()) {
+ if (FPT->getCallConv() != TmplFT->getCallConv() ||
+ FPT->getNoReturnAttr() != TmplFT->getNoReturnAttr()) {
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
EPI.ExtInfo = EPI.ExtInfo.withCallingConv(TmplFT->getCallConv());
+ EPI.ExtInfo = EPI.ExtInfo.withNoReturn(TmplFT->getNoReturnAttr());
FT = Context.getFunctionType(FPT->getResultType(), FPT->getArgTypes(),
EPI);
}
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Split from function-template-specialization.cpp because the noreturn warning
+// requires analysis-based warnings, which the other errors in that test case
+// disable.
+
+template <int N> void __attribute__((noreturn)) f3() { __builtin_unreachable(); }
+template <> void f3<1>() { } // expected-warning {{function declared 'noreturn' should not return}}