diff --git a/interpreter/cling/lib/Utils/AST.cpp b/interpreter/cling/lib/Utils/AST.cpp index e3533bdf5a1d1..e294c644fdbc9 100644 --- a/interpreter/cling/lib/Utils/AST.cpp +++ b/interpreter/cling/lib/Utils/AST.cpp @@ -1762,6 +1762,8 @@ namespace utils { PrintingPolicy Policy(Ctx.getPrintingPolicy()); Policy.SuppressScope = false; Policy.AnonymousTagLocations = false; + Policy.SuppressElaboration = true; + Policy.FullyQualifiedName = true; return FQQT.getAsString(Policy); } diff --git a/roottest/root/meta/CMakeLists.txt b/roottest/root/meta/CMakeLists.txt index 709ce83183daf..c90141764cade 100644 --- a/roottest/root/meta/CMakeLists.txt +++ b/roottest/root/meta/CMakeLists.txt @@ -38,6 +38,10 @@ ROOTTEST_ADD_TEST(loadernotapp OUTREF loadernotapp.ref DEPENDS ${GENERATE_EXECUTABLE_TEST}) +ROOTTEST_ADD_TEST(reproduceROOT10150 + MACRO reproduceROOT10150.C+ + FAILREGEX "error") + ROOTTEST_COMPILE_MACRO(fornamespace.C) #---Copy from source to binary some of the files diff --git a/roottest/root/meta/reproduceROOT10150.C b/roottest/root/meta/reproduceROOT10150.C new file mode 100644 index 0000000000000..6b7ac652f57ad --- /dev/null +++ b/roottest/root/meta/reproduceROOT10150.C @@ -0,0 +1,28 @@ +// reproducer from https://its.cern.ch/jira/browse/ROOT-10150 + +#include +#include +#include + +namespace Foo { +struct Particle { + float m_pt; + float pt() const { return m_pt; } +}; +} // namespace Foo + +template +FType get_functor(std::string const &functor_string) +{ + auto intern = gInterpreter->MakeInterpreterValue(); + gInterpreter->Evaluate(functor_string.c_str(), *intern); + return *static_cast(intern->GetAsPointer()); +} + +void reproduceROOT10150() +{ + auto functor = get_functor>( + "std::function( [](Foo::Particle const& particle){return particle.pt() > 15;} );"); + Foo::Particle low_pT_particle{1.f}, high_pT_particle{40.f}; + std::cout << functor(high_pT_particle) << " " << functor(low_pT_particle) << std::endl; +} diff --git a/tree/ntuple/test/ntuple_type_name.cxx b/tree/ntuple/test/ntuple_type_name.cxx index bcc4d56412c03..9542e0b6c3d64 100644 --- a/tree/ntuple/test/ntuple_type_name.cxx +++ b/tree/ntuple/test/ntuple_type_name.cxx @@ -216,13 +216,13 @@ TEST(RNTuple, TypeNameTemplatesNestedAlias) ASSERT_EQ(2, hashSubfields.size()); EXPECT_EQ("fHash", hashSubfields[0]->GetFieldName()); EXPECT_EQ("std::string", hashSubfields[0]->GetTypeName()); - EXPECT_EQ("EdmHash<1>::value_type", hashSubfields[0]->GetTypeAlias()); + EXPECT_EQ("EdmHash::value_type", hashSubfields[0]->GetTypeAlias()); EXPECT_EQ("fHash2", hashSubfields[1]->GetFieldName()); EXPECT_EQ("std::string", hashSubfields[1]->GetTypeName()); // FIXME: This should really be EdmHash<1>::value_typeT::value_type>, but this is the value we get from // TDataMember::GetFullTypeName right now... - EXPECT_EQ("value_typeT::value_type>", hashSubfields[1]->GetTypeAlias()); + EXPECT_EQ("EdmHash::value_typeT", hashSubfields[1]->GetTypeAlias()); } TEST(RNTuple, ContextDependentTypeNames) @@ -257,7 +257,7 @@ TEST(RNTuple, ContextDependentTypeNames) { const auto &fdesc = desc.GetFieldDescriptor(desc.FindFieldId("m", fooId)); EXPECT_EQ(fdesc.GetTypeName(), "std::vector"); - EXPECT_EQ(fdesc.GetTypeAlias(), "MyVec"); + EXPECT_EQ(fdesc.GetTypeAlias(), "CustomStruct::MyVec"); } { const auto &fdesc = desc.GetFieldDescriptor(desc.FindFieldId("a", baseId)); diff --git a/tree/ntuple/test/ntuple_types.cxx b/tree/ntuple/test/ntuple_types.cxx index 23ebbda982069..c665a692d056c 100644 --- a/tree/ntuple/test/ntuple_types.cxx +++ b/tree/ntuple/test/ntuple_types.cxx @@ -2261,7 +2261,7 @@ TEST(RNTuple, ContextDependentTypes) EXPECT_EQ(field.GetTypeName(), "DerivedWithTypedef"); const auto &vec = model.GetConstField("foo.m"); EXPECT_EQ(vec.GetTypeName(), "std::vector"); - EXPECT_EQ(vec.GetTypeAlias(), "MyVec"); + EXPECT_EQ(vec.GetTypeAlias(), "CustomStruct::MyVec"); auto vecView = reader->GetView>("foo.m"); for (const auto &i : reader->GetEntryRange()) {