From f9d14ac7d1349810a6c1d598a23943386fe3938b Mon Sep 17 00:00:00 2001 From: Danilo Piparo Date: Fri, 20 Nov 2026 23:27:05 +0100 Subject: [PATCH] [test] Branch of template class instantiation with typed enums as parameters --- tree/tree/test/TBranch.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tree/tree/test/TBranch.cxx b/tree/tree/test/TBranch.cxx index 5290046098c77..3c25477c81771 100644 --- a/tree/tree/test/TBranch.cxx +++ b/tree/tree/test/TBranch.cxx @@ -1,6 +1,8 @@ #include "TFile.h" #include "TTree.h" #include "TBranch.h" +#include "TInterpreter.h" +#include "TMemFile.h" #include "TRandom.h" #include "gtest/gtest.h" @@ -234,4 +236,17 @@ TEST_F(TBranchTest, branchInheritsCompression) { for(int mode = 4; mode >= 0; --mode) ASSERT_TRUE(nocomp(mode)) << "Failed for mode: " << mode; +} + +namespace EnumsParametersNamespace {enum class MyEnum { ZERO, ONE }; template class MyClass {};} +TEST(TBranch, EnumsParameters) +{ + auto code = "namespace EnumsParametersNamespace {enum class MyEnum { ZERO, ONE }; template class MyClass {};}"; + gInterpreter->Declare(code); + auto e = new EnumsParametersNamespace::MyClass(); + auto file = std::make_unique("init.root", "RECREATE"); + auto tree = std::make_unique("init", "init tree"); + const auto bName = "EnumsParametersNamespace::MyClass"; + auto branch = tree->Branch(bName, bName, &e); + ASSERT_NE(branch, nullptr); } \ No newline at end of file