This is an archive of the discontinued LLVM Phabricator instance.

Exception specification mismatch in explicit instantiation
ClosedPublic

Authored by ABataev on Oct 16 2014, 5:49 AM.

Details

Summary

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.

Diff Detail

Event Timeline

ABataev updated this revision to Diff 15013.Oct 16 2014, 5:49 AM
ABataev retitled this revision from to Exception specification mismatch in explicit instantiation.
ABataev updated this object.
ABataev edited the test plan for this revision. (Show Details)
ABataev added a reviewer: rsmith.
ABataev added a subscriber: Unknown Object (MLST).
rsmith added inline comments.Oct 24 2014, 1:05 PM
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.

Richard, thanks for the review.

include/clang/Basic/DiagnosticSemaKinds.td
3654–3657

Ok, fixed

lib/Sema/SemaTemplate.cpp
7637–7639

Agree, missed these variables somehow.

ABataev updated this revision to Diff 15549.Oct 29 2014, 6:09 AM

Fixed error and warning messages, use previously defined variables.

rsmith accepted this revision.Oct 30 2014, 5:59 PM
rsmith edited edge metadata.

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.

This revision is now accepted and ready to land.Oct 30 2014, 5:59 PM
ABataev closed this revision.Nov 6 2014, 2:21 AM
ABataev updated this revision to Diff 15846.

Closed by commit rL221448 (authored by @ABataev).