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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:30:29+00:00 2026-06-13T09:30:29+00:00

I am a bit puzzled about this. When default stack allocated object construction is

  • 0

I am a bit puzzled about this. When default stack allocated object construction is allowed as member varaiable of other struct, why not parameterized construction ? Does Most Vexing Parse has anything to do with this ? I tried on C++0X as well at ideone and got the same result.

struct foo{
    foo() {}
    foo(int i) {}
};

struct bar{
  foo obj;      // Allowed
  foo obj2(10); // Not Allowed
};

Error: expected ‘,’ or ‘…’ before numeric constant

IdeOne Demo

  • 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-13T09:30:30+00:00Added an answer on June 13, 2026 at 9:30 am

    Your link to Most Vexing Parse discusses instantiation of non-member variables (variables which are not a member of a class/struct). The example you’ve shown is that of member variables being declared in a struct; for which you would typically initialise them in a constructor

    struct bar
    {
        foo obj;
        foo obj2;
        bar() : obj2(10) {}
    };
    

    The Most Vexing Parse problem occurs in situations such as the below:

    struct baz
    {
        baz(int n) {}
    };
    
    void foo()
    {
        baz meow(int());
    }
    

    where the identifier meow appears to be a function declaration of type baz (int), due to the ‘most vexing parse’ issues described in your link. (the int() which at first glance appears to be default-initialisation actually turns out to be simply the data type int)

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

Sidebar

Related Questions

I'm a bit puzzled about the conditional operator. Consider the following two lines: Float
I am a bit puzzled by this strange behavior on CentOs 5.4 when starting
I'm no javascript wiz, but am a bit puzzled as to how this is
I am a bit puzzled about the best way to construct a stored procedure
I'm a bit puzzled about Zend Framework modules. I mean - I understand that
I am a bit puzzled with the Django object models. I have models like
I am a bit puzzled by this behaviour. I clone a table with jquery,
I'm a bit puzzled by this one. There are some methods in the Java
I'm a bit puzzled by the value of h in this experiment. In cpp,
Thanks for answers,Actually I am not puzzled about draw 1024*768 pixels is slower than

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.