aboutsummaryrefslogtreecommitdiff
path: root/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp')
-rw-r--r--test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp b/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
new file mode 100644
index 000000000000..f25a9c9984cc
--- /dev/null
+++ b/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
+
+#include <type_traits>
+
+#include "test_workarounds.h"
+
+template<class T>
+struct identity {
+ using type = T;
+};
+
+template<class...> struct list {};
+
+// C1XX believes this function template is not viable when LArgs is an empty
+// parameter pack.
+template <class ...LArgs>
+int f2(typename identity<LArgs>::type..., int i) {
+ return i;
+}
+
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+// C1XX believes this function template *is* viable when LArgs is an empty
+// parameter pack. Conforming compilers believe the two overloads are
+// ambiguous when LArgs is an empty pack.
+template <class ...LArgs>
+int f2(int i) {
+ return i;
+}
+#endif
+
+template <class ...LArgs, class ...Args>
+int f1(list<LArgs...>, Args&&... args) {
+ return f2<LArgs const&...>(args...);
+}
+
+int main() {
+ f1(list<>{}, 42);
+}