Search code examples
c++templatesspecializationpartial-specializationaccess-levels

Error with C++ partial specialization of template


I am using PC-Lint (great tool for static code analysis - see http://www.gimpel.com/) For the following chunk of code:

class ASD {
    protected:
        template<int N>
        void foo();
};

template<>
inline void ASD::foo<1>() {}

template<int N>
inline void ASD::foo() {}

PC-lint gives me a warning:

inline void ASD::foo<1>() {}
mysqldatabaseupdate.h(7) : Error 1060: protected member 'ASD::foo(void)' is not accessible to non-member non-friend functions

I believe the code is fine and the error is on the lint side, but I think Lint tool is REALLY great tool and it's more likely than I don't know something. So is this code OK?


Solution

  • The bug was in PC-Lint itself. It has been fixed in the newest version.