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


== Noncompliant Code 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; // Noncompliant, a conforming compiler will choose ::TYPE
    g ( ); // Noncompliant, a conforming compiler will choose ::g
  }
};

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

template class A<int32_t>;
----


== Compliant Solution

----
typedef int32_t TYPE;
void g ( );

template <typename T>
class B;

template <typename T>
class A : public B<T>
{
  void f1 ( )
  {
    ::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>;
----


== See

* MISRA {cpp}:2008, 14-6-1


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
