Skip to content

Odd output for decltype return values. Lambda hunt. #490

@olafurw

Description

@olafurw

Found two things that stood out as odd.

Case A

auto foo() -> decltype([](){ return 4; });

This defines a lambda class but then uses it like this

__lambda_5_24 foo();
() -> decltype([](){ return 4; });

Which does not seem like correct C++

image

Case B

using x = decltype([](){ return 4; });
auto foo() -> x;

Which should be the same as Case A but the output does seem more correct but it does not define a lambda class.

using x = decltype([](){ return 4; });
__lambda_19_20 foo();

image

Insights link.
https://cppinsights.io/s/51754024

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions