OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [lambda/] [lambda-deduce-ext.C] - Rev 378

Go to most recent revision | Compare with Previous | Blame | View Log

// Testcase for an extension to allow return type deduction when the lambda
// contains more than just a single return-statement.

// { dg-options -std=c++0x }
// { dg-do run }

bool b;
template <class T>
T f (T t)
{
  return [=] {
    auto i = t+1;
    if (b)
      return i+1;
    else
      return i+1;
  }();
}

int main()
{
  // Pointless, but well-formed.
  [] { return 1; return 2; }();

  if (f(1) != 3)
    return 1;
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.