llvm-for-llvmta/tools/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp

9 lines
294 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify
// expected-no-diagnostics
void test_noexcept() {
const auto lambda = [](int x) { return x + 1; };
static_assert(noexcept((int (*)(int))(lambda)),
"Lambda-to-function-pointer conversion is expected to be noexcept");
}