From 10797bb955d3051b6005b78b6d76f5cabfea5bf8 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Thu, 13 Jul 2023 15:05:16 -0700 Subject: [PATCH] -O gen-C++ fix for recent smart pointer changes --- src/script_opt/CPP/Stmts.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script_opt/CPP/Stmts.cc b/src/script_opt/CPP/Stmts.cc index af9ba0baed..a28b4bae92 100644 --- a/src/script_opt/CPP/Stmts.cc +++ b/src/script_opt/CPP/Stmts.cc @@ -406,14 +406,14 @@ void CPPCompile::GenWhenStmt(const WhenStmt* w) Emit("{ // begin a new scope for internal variables"); - Emit("static WhenInfo* CPP__wi = nullptr;"); + Emit("static std::shared_ptr CPP__wi = nullptr;"); Emit("static IDSet CPP__w_globals;"); NL(); Emit("if ( ! CPP__wi )"); StartBlock(); - Emit("CPP__wi = new WhenInfo(%s);", is_return); + Emit("CPP__wi = std::make_shared(%s);", is_return); for ( auto& wg : wi->WhenExprGlobals() ) Emit("CPP__w_globals.insert(find_global__CPP(\"%s\").get());", wg->Name()); EndBlock();