前一阵发现 GCC 一个 bug, 提交到了 gcc bugzilla ,已被确认,当然,这个 bug 有点刁钻:struct A { struct B {}; struct C { template void foo1(B*); template void foo2(B*) {} // ok }; template void foo1(B*); template void foo2(B*) {} // ok }; template void A::C::foo1(B*) {} // (1). fail template void A::foo1(B*) {} // (2). fail(1) (2) 两处都是合法…。