[PATCH] D40284: [Sema] Improve diagnostics for template arg deduction
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 22 14:00:30 PST 2017
erik.pilkington added a comment.
This looks correct, but I definitely agree that RAII would make this a lot nicer. Have you considered adding a `CancelableSaveAndRestore` or something to SaveAndRestore.h? It seems useful and generic enough to make it worthwhile. Otherwise, you could just write your own RAII object special-cased to handle this. A less intrusive way of doing this might be to wrap calls to this function with another that checks if the return value is TDK_Success, and if so restores these fields.
================
Comment at: lib/Sema/SemaTemplateDeduction.cpp:1376
if (const ComplexType *ComplexArg = Arg->getAs<ComplexType>())
return DeduceTemplateArgumentsByTypeMatch(S, TemplateParams,
cast<ComplexType>(Param)->getElementType(),
----------------
What if this return TDK_Success?
https://reviews.llvm.org/D40284
More information about the cfe-commits
mailing list