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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:40:40+00:00 2026-05-27T02:40:40+00:00

Taken from the C++0x FDIS (n3290): If a lambda-expression does not include a lambda-declarator,

  • 0

Taken from the C++0x FDIS (n3290):

If a lambda-expression does not include a lambda-declarator, it is as if the lambda-declarator were (). If a lambda-expression does not include a trailing-return-type, it is as if the trailing-return-type denotes the following type:

  • if the compound-statement is of the form
    { attribute-specifier-seqopt return expression ; }
    the type of the returned expression after lvalue-to-rvalue conversion (4.1), array-to-pointer conversion
    (4.2), and function-to-pointer conversion (4.3);
  • otherwise, void.

Why doesn’t the standard allow the compiler to analyse the compound-statement and determine the return type based on the first found return statement?

I can’t see any reason to not allow this, but maybe I’m overlooking something.

Example:

int main(){
  // compiler: nope.jpg
  auto l = []{
    // one computation
    // another computation
    // yet another one!
    return something;
  }
}

Edit: Please no “because the standard says so” answers. 🙂

  • 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-27T02:40:40+00:00Added an answer on May 27, 2026 at 2:40 am

    There’s no technical reason for this. IIRC it was already implemented by the GCC C++ maintainer and he said it’s trivial to implement.

    The committee is very conservative about accepting features into the Standard so they went with this simple form of deduction and will later hopefully accept a more powerful form. See the reason for rejection on US 30 comment.

    DR 975 is already marked “ready” so chances are good it will be accepted.

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

Sidebar

Related Questions

I have the following queue class (taken from wordpress): #include<iostream.h> class Queue { private:
Example taken from Mozilla's help page <script type="text/javascript"> re = /(\w+)\s(\w+)/; str = "John
This example is taken from w3schools . CREATE TABLE Persons ( P_Id int NOT
The following GCC inline asm is taken from LuaJit's coco library. Can someone provide
I have the following piece of code taken from the PHP manual on the
taken from: https://github.com/keithamus/jwerty Does anyone know how to unbind after setting up a .key
Consider the following example taken from http://www.albahari.com/threading/ : using System; using System.Threading; class ThreadTest
Taken from the Apache TreeList doc : The following relative performance statistics are indicative
The following code is taken from Project Silk (a Microsoft sample application) The publish
The following statement is taken from the CFMutableDictionary Reference section of the Mac OS

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.