summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py12
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp23
2 files changed, 35 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py
new file mode 100644
index 00000000000..b90f74656cd
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py
@@ -0,0 +1,12 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+# https://bugs.llvm.org/show_bug.cgi?id=35920
+# This test stresses expression evaluation support for template functions.
+# Currently the support is rudimentary, and running this test causes assertion
+# failures in clang. This test cannot be XFAIL'ed because the test harness
+# treats assertion failures as unexpected events. For now, the test must be
+# skipped.
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIf])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp
new file mode 100644
index 00000000000..eea2830aef8
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp
@@ -0,0 +1,23 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+template <class T> int staticSizeof() {
+ return sizeof(T);
+}
+
+template <class T1, class T2, class... Ts> int staticSizeof() {
+ return staticSizeof<T2, Ts...>() + sizeof(T1);
+}
+
+int main (int argc, char const *argv[])
+{
+ int sz = staticSizeof<long, int, char>();
+ return staticSizeof<long, int, char>() != sz; //% self.expect("expression -- sz == staticSizeof<long, int, char>()", "staticSizeof<long, int, char> worked", substrs = ["true"])
+ //% self.expect("expression -- sz == staticSizeof<long, int>() + sizeof(char)", "staticSizeof<long, int> worked", substrs = ["true"])
+ //% self.expect("expression -- sz == staticSizeof<long>() + sizeof(int) + sizeof(char)", "staticSizeof<long> worked", substrs = ["true"])
+}