Skip to content

C++20 lambda in unevaluated context not shown #468

@andreasfertig

Description

@andreasfertig

This is a copy from 467 from @JJCUBER, to track the issues individually.

Andreas


I just wanted to add that I've noticed a few other oddities when it comes to lambdas, including this (for C++20):

template<class F = decltype([]() { return true; })>
bool test(F f = {})
{
  return f();
}

int main()
{
  test();
}

generates

template<class F = decltype([]() { return true; })>
bool test(F f = {})
{
  return f();
}

/* First instantiated from: insights.cpp:9 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
bool test<__lambda_1_29>(__lambda_1_29 f)
{
  return f.operator()();
}
#endif


int main()
{
  test(__lambda_1_29{});
  return 0;
}

(It uses a class that was never declared/defined.)

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