File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,8 @@ bool ByteCodeStmtGen<Emitter>::visitStmt(const Stmt *S) {
255
255
return visitAsmStmt (cast<AsmStmt>(S));
256
256
case Stmt::AttributedStmtClass:
257
257
return visitAttributedStmt (cast<AttributedStmt>(S));
258
+ case Stmt::CXXTryStmtClass:
259
+ return visitCXXTryStmt (cast<CXXTryStmt>(S));
258
260
case Stmt::NullStmtClass:
259
261
return true ;
260
262
default : {
@@ -643,6 +645,12 @@ bool ByteCodeStmtGen<Emitter>::visitAttributedStmt(const AttributedStmt *S) {
643
645
return this ->visitStmt (S->getSubStmt ());
644
646
}
645
647
648
+ template <class Emitter >
649
+ bool ByteCodeStmtGen<Emitter>::visitCXXTryStmt(const CXXTryStmt *S) {
650
+ // Ignore all handlers.
651
+ return this ->visitStmt (S->getTryBlock ());
652
+ }
653
+
646
654
namespace clang {
647
655
namespace interp {
648
656
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ class ByteCodeStmtGen final : public ByteCodeExprGen<Emitter> {
65
65
bool visitDefaultStmt (const DefaultStmt *S);
66
66
bool visitAsmStmt (const AsmStmt *S);
67
67
bool visitAttributedStmt (const AttributedStmt *S);
68
+ bool visitCXXTryStmt (const CXXTryStmt *S);
68
69
69
70
bool emitLambdaStaticInvokerBody (const CXXMethodDecl *MD);
70
71
Original file line number Diff line number Diff line change @@ -739,3 +739,16 @@ namespace NonPrimitiveOpaqueValue
739
739
740
740
static_assert (!ternary(), " " );
741
741
}
742
+
743
+ namespace TryCatch {
744
+ constexpr int foo () {
745
+ int a = 10 ;
746
+ try {
747
+ ++a;
748
+ } catch (int m) {
749
+ --a;
750
+ }
751
+ return a;
752
+ }
753
+ static_assert (foo() == 11 );
754
+ }
You can’t perform that action at this time.
0 commit comments