diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2019-01-21 16:25:08 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2019-01-21 16:25:08 +0000 |
commit | 6384566c312e33af6ae1abde133c59bce264e647 (patch) | |
tree | 696e3b0b1ebf31b41f91e7f7dbdbe5a3a6ab3ba8 /test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp | |
parent | 01ff20bb48b440a99e80bad28420380835644c2f (diff) |
Mark the lambda function pointer conversion operator as noexcept.
This implements CWG DR 1722 and fixes PR40309. Patch by Ignat Loskutov.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351750 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp new file mode 100644 index 0000000000..2d3c69fc38 --- /dev/null +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p9.cpp @@ -0,0 +1,8 @@ +// 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"); +} |