Skip to content
Snippets Groups Projects
Commit 235ecb78 authored by scott snyder's avatar scott snyder Committed by scott snyder
Browse files

ReweightUtils: Fix gcc11 warnings.

Check result of dynamic_cast before dereferencing.
parent 1842c8d2
No related branches found
No related tags found
No related merge requests found
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -115,12 +115,14 @@ int main() { ...@@ -115,12 +115,14 @@ int main() {
CP::SystematicSet s; s.insert(CP::SystematicVariation("mySyst",1)); CP::SystematicSet s; s.insert(CP::SystematicVariation("mySyst",1));
dynamic_cast<CP::ISystematicsTool*>(&*myTool4)->applySystematicVariation(s).ignore(); auto isyst4 = dynamic_cast<CP::ISystematicsTool*>(&*myTool4);
if (!isyst4) std::abort();
isyst4->applySystematicVariation(s).ignore();
std::cout << myTool4->evaluate(e) << std::endl; //should print 5.0 std::cout << myTool4->evaluate(e) << std::endl; //should print 5.0
s.clear(); s.insert(CP::SystematicVariation("mySyst",-1)); s.clear(); s.insert(CP::SystematicVariation("mySyst",-1));
dynamic_cast<CP::ISystematicsTool*>(&*myTool4)->applySystematicVariation(s).ignore(); isyst4->applySystematicVariation(s).ignore();
std::cout << myTool4->evaluate(e) << std::endl; //should print 1.0 std::cout << myTool4->evaluate(e) << std::endl; //should print 1.0
return 0; //zero = success return 0; //zero = success
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment