diff --git a/lib/Differentiator/StmtClone.cpp b/lib/Differentiator/StmtClone.cpp index 4d9db2464..91afe9743 100644 --- a/lib/Differentiator/StmtClone.cpp +++ b/lib/Differentiator/StmtClone.cpp @@ -459,6 +459,8 @@ VarDecl* StmtClone::CloneDeclOrNull(VarDecl* Node) { } Decl* StmtClone::CloneDecl(Decl* Node) { + if (!Node) + return nullptr; // we support only exactly this class, so no visitor is needed (yet?) if (Node->getKind() == Decl::Var) { VarDecl* VD = static_cast(Node); diff --git a/test/FirstDerivative/DiffInterface.C b/test/FirstDerivative/DiffInterface.C index 13bd42394..dda26f136 100644 --- a/test/FirstDerivative/DiffInterface.C +++ b/test/FirstDerivative/DiffInterface.C @@ -75,6 +75,9 @@ int f_try_catch(int x) catch (int) { return 0; } + catch (...) { + return 1; + } // CHECK: int f_try_catch_darg0(int x) { // CHECK-NEXT: int _d_x = 1; @@ -82,6 +85,8 @@ int f_try_catch(int x) // CHECK-NEXT: return x; // CHECK-NEXT: } catch (int) { // CHECK-NEXT: return 0; +// CHECK-NEXT: } catch (...) { +// CHECK-NEXT: return 1; // CHECK-NEXT: } // CHECK-NEXT: }