r229374 - ASTMatchers: Replace enable_if with static_assert.
Benjamin Kramer
benny.kra at googlemail.com
Mon Feb 16 03:08:02 PST 2015
Author: d0k
Date: Mon Feb 16 05:08:00 2015
New Revision: 229374
URL: http://llvm.org/viewvc/llvm-project?rev=229374&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=229374&r1=229373&r2=229374&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Mon Feb 16 05:08:00 2015
@@ -1178,14 +1178,10 @@ template <unsigned MinCount, unsigned Ma
struct VariadicOperatorMatcherFunc {
DynTypedMatcher::VariadicOperator Op;
- template <unsigned Count, typename T>
- struct EnableIfValidArity
- : public std::enable_if<MinCount <= Count && Count <= MaxCount, T> {};
-
template <typename... Ms>
- typename EnableIfValidArity<sizeof...(Ms),
- VariadicOperatorMatcher<Ms...>>::type
- operator()(Ms &&... Ps) const {
+ VariadicOperatorMatcher<Ms...> operator()(Ms &&... Ps) const {
+ static_assert(MinCount <= sizeof...(Ms) && sizeof...(Ms) <= MaxCount,
+ "invalid number of parameters for variadic matcher");
return VariadicOperatorMatcher<Ms...>(Op, std::forward<Ms>(Ps)...);
}
};
More information about the cfe-commits
mailing list