]> granicus.if.org Git - clang/commit
[constexpr][c++2a] Try-catch blocks in constexpr functions
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Mon, 10 Dec 2018 19:03:12 +0000 (19:03 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Mon, 10 Dec 2018 19:03:12 +0000 (19:03 +0000)
commitc8fa6148983ea7b1b222dc7f3c89dab72bef1a1c
tree712d8a9c9cbf8d1d944d85fb8bd5b86fe98e7a48
parent3a75a3f01987e6544fa9dcc27e4f5bc38208a7c2
[constexpr][c++2a] Try-catch blocks in constexpr functions

Implement support for try-catch blocks in constexpr functions, as
proposed in http://wg21.link/P1002 and voted in San Diego for c++20.

The idea is that we can still never throw inside constexpr, so the catch
block is never entered. A try-catch block like this:

try { f(); } catch (...) { }

is then morally equivalent to just

{ f(); }

Same idea should apply for function/constructor try blocks.

rdar://problem/45530773

Differential Revision: https://reviews.llvm.org/D55097

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348789 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/AST/ExprConstant.cpp
lib/Sema/SemaDeclCXX.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp
test/CXX/drs/dr6xx.cpp
www/cxx_status.html