gri*_*ras 5 c++ gcc templates c++11
当我尝试实例化这样的模板时,GCC给我一个"模板参数2无效"错误(见using Check行).我很好奇,我可以使用decltype模板参数列表之外的成员来获取指向成员的指针,但不在其中(请参阅变量的定义p2).事实上,Clang编译了这段代码.这是GCC中的一个错误,或者这段代码实际上是无效的,而且Clang只是过于包容?
template <class T, T t> struct checker_template {};
struct S { int n; };
int main() {
  S s;
  constexpr auto p1 = &S::n;
  constexpr auto p2 = &decltype(s)::n;
  using Check = checker_template<int S::*, &decltype(s)::n>;
  return 0;
}