From: Benjamin Kramer Date: Mon, 16 Feb 2015 11:08:00 +0000 (+0000) Subject: ASTMatchers: Replace enable_if with static_assert. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=906491e3957771313cf8f77ac2a21edbf7725986;p=clang ASTMatchers: Replace enable_if with static_assert. This is nicer in general and gives a better error message, but it also might bring MSVC 2013 back to life. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229374 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h index 2b98e9a6c4..3f4d64936e 100644 --- a/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -1178,14 +1178,10 @@ template struct VariadicOperatorMatcherFunc { DynTypedMatcher::VariadicOperator Op; - template - struct EnableIfValidArity - : public std::enable_if {}; - template - typename EnableIfValidArity>::type - operator()(Ms &&... Ps) const { + VariadicOperatorMatcher operator()(Ms &&... Ps) const { + static_assert(MinCount <= sizeof...(Ms) && sizeof...(Ms) <= MaxCount, + "invalid number of parameters for variadic matcher"); return VariadicOperatorMatcher(Op, std::forward(Ps)...); } };