Integral constant passed by value, treated as constexpr?
问题 Although I've used code like this before, and it's clear that the compiler has enough information to work, I don't really understand why this compiles: template <class T, class I> auto foo(const T& t, I i) { return std::get<i>(t); } int main() { std::cerr << foo(std::make_tuple(3,4), std::integral_constant<std::size_t, 0>{}); return 0; } Live example: http://coliru.stacked-crooked.com/a/fc9cc6b954912bc5. Seems to work with both gcc and clang. The thing is that while integral_constant has a