Hi rsmith,
As requested when applying the same logic to calling conventions.
http://llvm-reviews.chandlerc.com/D1634
Files:
lib/Sema/SemaTemplate.cpp
test/SemaTemplate/function-template-specialization.cpp
Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6415,12 +6415,15 @@
}
}
- // 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);
}
Index: test/SemaTemplate/function-template-specialization.cpp
===================================================================
--- test/SemaTemplate/function-template-specialization.cpp
+++ test/SemaTemplate/function-template-specialization.cpp
@@ -56,3 +56,6 @@
template<>
static void Bar(const long& input) {} // expected-error{{explicit
specialization of 'Bar' in class scope}}
};
+
+template <int N> void __attribute__((noreturn)) f3() {
__builtin_unreachable(); }
+template <> void f3<1>() { }
Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6415,12 +6415,15 @@
}
}
- // 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);
}
Index: test/SemaTemplate/function-template-specialization.cpp
===================================================================
--- test/SemaTemplate/function-template-specialization.cpp
+++ test/SemaTemplate/function-template-specialization.cpp
@@ -56,3 +56,6 @@
template<>
static void Bar(const long& input) {} // expected-error{{explicit specialization of 'Bar' in class scope}}
};
+
+template <int N> void __attribute__((noreturn)) f3() { __builtin_unreachable(); }
+template <> void f3<1>() { }
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits