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 9171049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:06:37+00:00 2026-06-17T16:06:37+00:00

I’ve got the following g++ error Menu.hpp:66:41: error: no matching function for call to

  • 0

I’ve got the following g++ error

Menu.hpp:66:41: error: no matching function for call to ‘Menu::Stack<Submenu*>::push(Submenu*)’
Menu.hpp:66:41: note: candidate is:
Menu.hpp:14:21: note: void Menu::Stack<T>::push(T&) [with T = Submenu*]
Menu.hpp:14:21: note:   no known conversion for argument 1 from ‘Submenu*’ to ‘Submenu*&’

How can such a conversion be impossible? On what sort of occasions does compiler issue such errors?

As to what I was actually doing:

  • I have a class Submenu
  • I have a class Menu which inherits from Submenu
  • Menu has additional field of type Stack<Submenu*> which maps remembering open submenus
  • All methods of Menu like "open menu", "click menu item" and so on refer to the Submenu that is currently on top() of the stack. Within class Submenu, they operate on the object itself.
  • Menu has a public method of closing the current submenu and going up – i.e. popping the submenu from the stack.
  • Menu can pop until it reaches itself, see below what does it mean.

Now is the part that is most probably the issue, namely, the constructor of Menu:

Menu() { stack.push( (Submenu*)this ); }

It does so because when all menus get closed, methods relative to stack.top() should refer to the Menu itself, being a kind of Submenu too (since it inherits from it).

EDIT:

I’ve made my own class Stack instead of using std::stack (as I initially suggested) and, as pointed out in the answer, there lied the problem. Excuse me for that inaccuracy.

  • 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-06-17T16:06:38+00:00Added an answer on June 17, 2026 at 4:06 pm

    Generally, you can only convert lvalues to references, not rvalues (a cast is an rvalue). You can convert rvalues to const references, which is probably what you really want here — if you change Stack::push to take a const T & argument instead of a T &, the errors will go away.

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
i got an object with contents of html markup in it, for example: string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I

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.