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

  • Home
  • SEARCH
  • 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 876163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:23:25+00:00 2026-05-15T11:23:25+00:00

My program has a class with a vector of Level objects named levels .

  • 0

My program has a class with a vector of Level objects named levels. In a member function there is this line:

levels.push_back(level::Level());

I made several changes to my program today, and that line of code started segfaulting:

0x0804d248 in void std::vector<yarl::level::Level, std::allocator<yarl::level::Level> >::emplace_back<yarl::level::Level>(yarl::level::Level&&) (this=0x0, 
__args#0=...) at /usr/include/c++/4.4/bits/vector.tcc:93
93      if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)

I thought that the Level object may have somehow become corrupt, so I declared it outside the function call so I could inspect it in gdb, like this:

level::Level foo();
levels.push_back(foo);

Turns out this doesn’t compile. It g++ gives two errors I haven’t seen before:

error: invalid conversion from 'level::Level (*)()' to 'int'
error: initializing argument 1 of 'level::Level::Level(int, int, int)'

Now, Level‘s constructor takes three integer parameters, each with default values. I thought it might have been complaining that I hadn’t passed those three parameters, even though they have defaults, so I changed the first line to pass the value of the defaults:

level::Level foo(1, 100, 100);

This now compiles, and still segfaults, but does so at a different spot (although an identical test):

0x0804c699 in std::vector<yarl::level::Level, std::allocator<yarl::level::Level> >::push_back (this=0x0, __x=...) at /usr/include/c++/4.4/bits/stl_vector.h:735
735     if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)

I realize this is too little code to expect you guys to be able to solve my problem, but perhaps someone could tell me a little more about what these errors mean? Those g++ errors especially; I don’t know why it wouldn’t accept an empty Level constructor given that all its parameters are default, and I have no idea what the (*)() part of the error means (it makes the error a very frustrating one to google).

  • 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-15T11:23:26+00:00Added an answer on May 15, 2026 at 11:23 am
    level::Level foo();
    

    That declares a function named foo that takes no arguments and returns a level::Level. This is known as the most vexing parse. This creates a level::Level using the default constructor:

    level::Level foo;
    

    As for your original problem, you appear to have a null this pointer:

    ... ::push_back (this=0x0, __x=...) ...
    

    This could happen if levels is a reference to null. Did you create the reference by dereferencing a null pointer?

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

Sidebar

Ask A Question

Stats

  • Questions 481k
  • Answers 481k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer import project.ui or from project import ui should do the… May 16, 2026 at 6:25 am
  • Editorial Team
    Editorial Team added an answer Do you have an OptionalFields.xaml? If so, it is automatically… May 16, 2026 at 6:25 am
  • Editorial Team
    Editorial Team added an answer From the C# spec: "A using statement of the form… May 16, 2026 at 6:25 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.