xref: /llvm-project/lldb/test/API/lang/cpp/function-template-parameter-pack/main.cpp (revision fdea9a4ec9b0d9585b8fe8a612686d9f44f40ddc)

staticSizeof()1*99451b44SJordan Rupprecht template <class T> int staticSizeof() {
2*99451b44SJordan Rupprecht   return sizeof(T);
3*99451b44SJordan Rupprecht }
4*99451b44SJordan Rupprecht 
staticSizeof()5*99451b44SJordan Rupprecht template <class T1, class T2, class... Ts> int staticSizeof() {
6*99451b44SJordan Rupprecht   return staticSizeof<T2, Ts...>() + sizeof(T1);
7*99451b44SJordan Rupprecht }
8*99451b44SJordan Rupprecht 
main(int argc,char const * argv[])9*99451b44SJordan Rupprecht int main (int argc, char const *argv[])
10*99451b44SJordan Rupprecht {
11*99451b44SJordan Rupprecht   int sz = staticSizeof<long, int, char>();
12*99451b44SJordan Rupprecht   return staticSizeof<long, int, char>() != sz; //% self.expect("expression -- sz == staticSizeof<long, int, char>()", "staticSizeof<long, int, char> worked", substrs = ["true"])
13*99451b44SJordan Rupprecht                                   //% self.expect("expression -- sz == staticSizeof<long, int>() + sizeof(char)", "staticSizeof<long, int> worked", substrs = ["true"])
14*99451b44SJordan Rupprecht                                   //% self.expect("expression -- sz == staticSizeof<long>() + sizeof(int) + sizeof(char)", "staticSizeof<long> worked", substrs = ["true"])
15*99451b44SJordan Rupprecht }
16