Does a virtual function override a non-virtual function of the same name in a base class?
<p>Is the following standard conforming? Can you cite the section?</p>

<pre><code>struct A
{
    virtual void func() = 0;
};

struct B
{
    void func(){}
};

struct C : public A, public B
{
    virtual void func(){ B::func(); }
};
</code></pre>

<p>I'm getting a strange compiler warning in VS2010 in equivalent but more complicated code pointing to <code>func</code>'s declaration in the derived-most class: <code>warning C4505: unreferenced local function has been removed</code>. I have no idea why the compiler thinks a virtual function declared in a class is a local; however I can't repro that warning in a simpler example.</p>

<h1>Edit:</h1>

<p>I figured out a small repro case for the warning. I think I was going down the wrong path assuming it was related to function hiding. Here's the repro case:</p>

<pre><code>template&lt;typename T&gt;
struct C
{
    int GetType() const;
    virtual int func() const;   // {return 4;}  //  Doing this inline removes the warning &lt;--------------
};

template&lt;typename T&gt;
int C&lt;T&gt;::GetType() const
{
    return 0;
}

template&lt;&gt;
int C&lt;int&gt;::GetType() const
{
    return 12;
}

template&lt;typename T&gt; 
int C&lt;T&gt;::func() const
{
    return 3; 
}

//  Adding the following removes the warning &lt;--------------------
//  template&lt;&gt;
//  int C&lt;int&gt;::func() const
//  {
//      return 4;
//  }
</code></pre>

<p>I'm fairly sure this is just a VS2010 bug.</p>
