Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6471973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:17:14+00:00 2026-05-25T06:17:14+00:00

g++ complains about myclass.cxx:185: error: no matching function for call to ‘IMyInterface::doSomething(const SomeClass*, unsigned

  • 0

g++ complains about

myclass.cxx:185: error: no matching function for call to 'IMyInterface::doSomething(const SomeClass*, unsigned int)'
IMyInterface.h:34: note: candidates are: virtual void IMyInterface::doSomething(const SomeClass*&, unsigned int)

when I call

m_instanceOfInterface->doSomething((const SomeClass*)0,(unsigned int)1);

Any pointers to why? It seems to me that g++ is seeing exactly the same signature between what is declared and what is being called, but still complains about no matching function found.

I can call, in the same context, another function of IMyInteface, IMyInterface::doSomethingElse(float& p). So somehow the const is the problem?


I did not pass the NULL pointer and cast a constant integer just for fun… originally I have

m_instanceOfInterface->doSomething((const SomeClass*)m_someDerivedClass,m_anInteger);

and got the same error. So I decided to clarify things with g++ by giving some explicit arguments. I can assure you that the NULL pointer is NOT the problem – although understandably we all cringed a bit when seeing a NULL being passed with const 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:17:14+00:00Added an answer on May 25, 2026 at 6:17 am

    The function requires its argument by non-const reference, which cannot bind to a temporary. Observe:

    void foo(int, T &);
    foo(1, T()); // error, cannot bind to temporary
    

    In your case, T = SomeClass const *. So, you have provide a non-temporary:

    SomeClass const * pc = 0;
    m_instanceOfInterface->doSomething(pc, 1U);
    

    Note that the purpose of this is presumably to fill pc with some meaningful value, so be sure to incorporate that apporpriately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code won't compile. The compiler complains about *no matching function for call
When writing code like this jsLint complains about implied globals: var Test = (function(){
My following script is producing an error (it complains about expecting 'then' keyword before
The compiler complains about this, after I activated all kind of warnings: For MyApp_Prefix.pch
Our static analysis tool complains about a useless type qualifier on return type when
The compiler complains about this code: HashMap<String,int> userName2ind = new HashMap<String,int>(); for (int i=0;
g++ compiler complains about conversions between related types (from int to enum, from void*
The naïve FOO = empty_clob() complains about incompatible types. I tried Googling, but (once
In Podcast 58 (about 20 minutes in), Jeff complains about the problems of HTML.Encode()
At the XmlSerializer constructor line the below causes an InvalidOperationException which also complains about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.