Can non-type template parameters in c++17 be decltype(auto)?
问题 I discovered that gcc and clang allow to use decltype(auto) in non-type template parameter type clause. E.g.: template <decltype(auto)> struct X {}; int foo ; int main() { X<(foo)> x; static_cast<void>(x); } [live demo gcc] [live demo clang] Is it standard compliant feature or is it some gnu extension? 回答1: This is standard. First, for a non-type template parameter: [temp.param/4] A non-type template-parameter shall have one of the following (optionally cv-qualified) types: ... a type that