Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

MISRA.TEMPLMEM.NOQUAL

Switch statement is not well-formed.

MISRA-C++ Rule 14-6-1 (required): In a class template with a dependent base, any name that may be found in that dependent base shall be referred to using a ''qualified-id'' or 'this->'

Rationale

Using a qualified-id or prefixing the identifier with 'this->' ensures that the entity chosen is consistent with developer expectations.

Example

typedef int32_t TYPE;
void g ( );

template <typename T>
class B;

template <typename T>
class A : public B<T>
{
   void f1 ( )
   {
      TYPE t = 0; // Non-compliant Example 1
      g ( ); // Non-compliant Example 2
   }

   void f2 ( )
   {
      ::TYPE t1 = 0; // Compliant - explicit use global TYPE
      ::g ( ); // Compliant - explicit use global func

      typename B<T>::TYPE t2 = 0; // Compliant - explicit use base TYPE
      this->g ( ); // Compliant - explicit use base "g"
   }
};

template <typename T>
class B
{
public:
   typedef T TYPE;
   void g ( );
};

template class A<int32_t>;

A conforming compiler will choose '::TYPE' in Example 1, and '::g' in Example 2.