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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:43:08+00:00 2026-05-23T22:43:08+00:00

This question arose from being unable to use uniform-initialisation syntax with the auto keyword

  • 0

This question arose from being unable to use uniform-initialisation syntax with the auto keyword because it treats it as a std::initializer_list<T> (explanation in the comments here).

Take the following code example:

class X { };
int x( X() ); // function prototype (1)
auto x( X() );  // copy/move construction of an X, function prototype or compile-time error?

What does the compiler do with auto x?

Reasoning for each possibility:

Copy/move construction: I can see this being the proper behaviour due to (1) being seen as a kind of defect.

Function prototype: Seems unlikely as there is no trailing return type.

Compile-time error: If the compiler does parse this as a function prototype, it may cause a compile-time error due to lacking a trailing return type.

What does the C++0x standard say this should be interpreted as?

  • 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-23T22:43:08+00:00Added an answer on May 23, 2026 at 10:43 pm

    I get

    error: 'x' function uses 'auto' type specifier without late return type
    

    The compiler is expecting something like

    auto x( X() ) -> int;
    

    which would be equivalent to line 2.

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

Sidebar

Related Questions

This question arose from the discussion in the comments of this answer . First,
Earlier today I asked this question which arose from A- My poor planning and
This arose from a question earlier today on the subject of bignum libraries and
This question is about removing sequences from an array, not duplicates in the strict
This question is being based off of a similar question titled, ASP.NET MVC Relative
I've this question from an assignment to create a Store which rent out books,
This question arose out of something strange that I noticed after investigating this question
This question arose for me while reading the Sha1-PHP Manpage It says there: If
Note: this appears to have been fixed in Roslyn This question arose when writing
This question is kind of an add-on to this question In C#, a switch

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.