我正在使用 PC-Lint(用于静态代码分析的出色工具 - 请参阅http://www.gimpel.com/)对于以下代码块:
class ASD {
protected:
template<int N>
void foo();
};
template<>
inline void ASD::foo<1>() {}
template<int N>
inline void ASD::foo() {}
PC-lint 给了我一个警告:
inline void ASD::foo<1>() {}
mysqldatabaseupdate.h(7) : Error 1060: protected member 'ASD::foo(void)' is not accessible to non-member non-friend functions
我相信代码很好,错误就在 lint 方面,但我认为 Lint 工具真的是很棒的工具,而且它更有可能比我不知道的东西。那么这段代码可以吗?