According to C++ standard if an exception-specification is specified in an explicit instantiation directive, it shall be compatible with the exception-specifications of other declarations of that function. This patch adds checks for this.
Details
Diff Detail
Event Timeline
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
3654–3657 | "deduced" is not correct here; "instantiated" would be better. | |
lib/Sema/SemaTemplate.cpp | ||
7637–7639 | This is duplicating work the function has already done. (See variables T and R declared earlier.) Instead of checking whether the declarator has an exception specification, you can instead check whether R is a FunctionProtoType with an exception specification. |
LGTM with a tweak to the testing.
test/SemaTemplate/explicit-instantiation-cxx11.cpp | ||
---|---|---|
2 | Rather than copying this test, give the original test two RUN: lines. Use #if __cplusplus >= 201103L to disable the C++11-specific bits for the C++98 run of the test. |
"deduced" is not correct here; "instantiated" would be better.