Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • bob bob
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • bobbob
  • bobbob
  • Issues
  • #117
Closed
Open
Issue created Apr 03, 2013 by André Anjos@andre.anjos💬Owner

"hides overloaded virtual function [-Woverloaded-virtual]" warnings with llvm/clang

Created by: laurentes

I've noticed the following warnings when we use the llvm/clang compiler (only on OS X):

/Users/buildbot/work/buildbot/macosx-10.8-x86_64-incremental+master/build/include/bob/trainer/IVectorTrainer.h:122:10: warning: 'bob::trainer::IVectorTrainer::is_similar_to' hides overloaded virtual function [-Woverloaded-virtual]
1 warning generated.
/Users/buildbot/work/buildbot/macosx-10.8-x86_64-incremental+master/build/include/bob/trainer/IVectorTrainer.h:122:10: warning: 'bob::trainer::IVectorTrainer::is_similar_to' hides overloaded virtual function [-Woverloaded-virtual]
1 warning generated.

cf. here

I don't understand why this is occuring. Does anyone have a clue? The recipe to get rid of them is to change the inline definition in the templated class EMTrainer

virtual bool is_similar_to(const EMTrainer& b, const double r_epsilon=1e-5, const double a_epsilon=1e-8) const 
{   
  return m_compute_likelihood == b.m_compute_likelihood &&
           bob::core::isClose(m_convergence_threshold, b.m_convergence_threshold, r_epsilon, a_epsilon) &&
           m_max_iterations == b.m_max_iterations;
}   

into a single declaration within the EMTrainer class definition

bool is_similar_to(const IVectorTrainer& b, const double r_epsilon=1e-5, const double a_epsilon=1e-8) const;

and a definition of this method outside the class as follows

template<class T_machine, class T_sampler>
bool bob::trainer::EMTrainer<T_machine,T_sampler>::is_similar_to(const bob::trainer::EMTrainer<T_machine,T_sampler>& b,
  const double r_epsilon, const double a_epsilon) const
{
  return m_compute_likelihood == b.m_compute_likelihood &&
         bob::core::isClose(m_convergence_threshold, b.m_convergence_threshold, r_epsilon, a_epsilon) &&
         m_max_iterations == b.m_max_iterations;
}

This only happens for is_similar_to method and not for operator==(), which means that the default/optional arguments might be the cause of the problem.

Assignee
Assign to
Time tracking