[PATCH] D56918: [clang-tidy] add reproducer for PR39949 into test-suite

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 10:08:00 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL351569: [clang-tidy] add reproducer for PR39949 into test-suite (authored by JonasToth, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56918/new/

https://reviews.llvm.org/D56918

Files:
  clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp


Index: clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
@@ -430,3 +430,36 @@
   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([] {});
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56918.182551.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/09e4eedc/attachment.bin>


More information about the cfe-commits mailing list