I try to create a List from C++ API, but I keep getting a compilation error for code as simple as this one:
c10::List<c10::IValue> list;

I get this error:
In file included from /usr/local/include/ATen/core/List.h:472:0,
                 from /usr/local/include/ATen/core/ivalue_inl.h:13,
                 from /usr/local/include/ATen/core/ivalue.h:895,
                 from /usr/local/include/ATen/ATen.h:33,
                 from /usr/local/include/torch/csrc/api/include/torch/types.h:3,
                 from /usr/local/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /usr/local/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /usr/local/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /usr/local/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /usr/local/include/torch/csrc/api/include/torch/data.h:3,
                 from /usr/local/include/torch/csrc/api/include/torch/all.h:8,
                 from /usr/local/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/aaaa/bbbbb/test.cc:2:
/usr/local/include/ATen/core/List_inl.h: In instantiation of ‘c10::List<T>::List() [with T = c10::IValue]’:
/usr/local/include/ATen/core/ivalue_inl.h:976:62:   required from ‘c10::IValue::IValue(const std::vector<T>&) [with T = c10::IValue; typename std::enable_if<std::is_constructible<c10::IValue, T>::value, std::nullptr_t>::type <anonymous> = nullptr]’
/home/aaaa/bbbbb/torch_exp/test.cc:89:49:   required from here
/usr/local/include/ATen/core/List_inl.h:20:3: error: static assertion failed: This constructor is not valid for List<IValue>. Please use c10::impl::GenericList(elementType) instead.
   static_assert(!std::is_same<T, IValue>::value, "This constructor is not valid for List<IValue>. Please use c10::impl::GenericList(elementType) instead.");
   ^~~~~~~~~~~~~

Am I trying to create a list the wrong way? In which case, what is the correct way of creating list of IValues? I want to pass them to a jit module that takes a List of Tensor as input
And I don’t understand why this assert is triggering, since std::is_same<T, IValue>::value should be true for T == c10::IValue ?