diff options
author | Jonas Toth <jonas.toth@gmail.com> | 2019-01-18 18:03:11 +0000 |
---|---|---|
committer | Jonas Toth <jonas.toth@gmail.com> | 2019-01-18 18:03:11 +0000 |
commit | ae17ff0781d055488cfa9132c3a06229ebdca886 (patch) | |
tree | e62b33b00e73c2c4933a2e92b33ca006bd8df623 | |
parent | d08d90ce51d23ed00fe2442d8850953798859a56 (diff) | |
download | bcm5719-llvm-ae17ff0781d055488cfa9132c3a06229ebdca886.tar.gz bcm5719-llvm-ae17ff0781d055488cfa9132c3a06229ebdca886.zip |
[clang-tidy] add reproducer for PR39949 into test-suite
Summary:
The underlying issue is fixed in https://reviews.llvm.org/D56444
and this test ensures the issue does not creep back into our
code-base.
Reviewers: alexfh, aaron.ballman, hokein, hwright
Reviewed By: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D56918
llvm-svn: 351569
-rw-r--r-- | clang-tools-extra/test/clang-tidy/abseil-upgrade-duration-conversions.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/abseil-upgrade-duration-conversions.cpp b/clang-tools-extra/test/clang-tidy/abseil-upgrade-duration-conversions.cpp index 7d8ad43e720..fed0f8bd773 100644 --- a/clang-tools-extra/test/clang-tidy/abseil-upgrade-duration-conversions.cpp +++ b/clang-tools-extra/test/clang-tidy/abseil-upgrade-duration-conversions.cpp @@ -430,3 +430,36 @@ void factoryInMacros() { factoryTemplateAndMacro<ConvertibleTo<int>>(); TemplateFactoryInMacro(ConvertibleTo<int>()); } + +// This is a reduced test-case for PR39949 and manifested in this check. +namespace std { +template <typename _Tp> +_Tp declval(); + +template <typename _Functor, typename... _ArgTypes> +struct __res { + template <typename... _Args> + static decltype(declval<_Functor>()(_Args()...)) _S_test(int); + + template <typename...> + static void _S_test(...); + + typedef decltype(_S_test<_ArgTypes...>(0)) type; +}; + +template <typename> +struct function; + +template <typename... _ArgTypes> +struct function<void(_ArgTypes...)> { + template <typename _Functor, + typename = typename __res<_Functor, _ArgTypes...>::type> + function(_Functor) {} +}; +} // namespace std + +typedef std::function<void(void)> F; + +F foo() { + return F([] {}); +} |