view gcc/testsuite/g++.dg/cpp1z/constexpr-lambda7.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Testcase from P0170R1
// { dg-do compile { target c++17 } }

auto ID = [](auto a) { return a; };
static_assert( ID (3) == 3); // OK
struct NonLiteral {
  NonLiteral(int n) : n(n) { }
  int n;
};

static_assert( ID (NonLiteral{3}).n == 3); // { dg-error "non-literal" }
// { dg-prune-output "static assertion" }