Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions root/meta/naming/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ ROOTTEST_ADD_AUTOMACROS(DEPENDS namingMatches.cxx
ROOTTEST_ADD_TEST(execCheckNaming
MACRO execCheckNaming.C
OUTREF execCheckNaming${ref_suffix})

ROOTTEST_ADD_TESTDIRS()
6 changes: 6 additions & 0 deletions root/meta/naming/issue-18363/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ROOTTEST_GENERATE_REFLEX_DICTIONARY(size_tTemplateDict Objects.h SELECTION selection.xml FIXTURES_SETUP size_tTemplate_lib)

ROOTTEST_ADD_TEST(size_tTemplateName
MACRO size_tTemplateNameTest.C
OUTREF size_tTemplateNameTest.ref
FIXTURES_REQUIRED size_tTemplate_lib)
12 changes: 12 additions & 0 deletions root/meta/naming/issue-18363/Objects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef Objects_18363_hxx
#define Objects_18363_hxx

namespace reco {
template <size_t I, bool B> struct PFRecHitSoALayout {
template <size_t II, bool B1, bool B2, bool B3> struct ViewTemplateFreeParams {};
using View = ViewTemplateFreeParams<I, B, true, true>;
};
using PFRecHitSoA = PFRecHitSoALayout<128,false>; // The result is the same with 128UL or 128ul
}
Comment on lines +4 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimal reproducer to trigger the problem is:

template <unsigned I> struct PFRecHitSoALayout {
   struct View {}; 
};

This normalizes to PFRecHitSoALayout<128U>::View.

A couple of conclusions:

  1. The problem is not particular to size_t, it just has to be a builtin type where printIntegral decides to print a suffix.
  2. It has nothing to do with using declarations that "forward" a template argument.
  3. It is not even required for the inner type to be a template.

FYI @vgvassilev (not a standalone reproducer yet)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recalled correctly, it does not add the suffix for int. I.e. being an unsigned type might be the discriminant.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as I write

it just has to be a builtin type where printIntegral decides to print a suffix

That's not the case for int, but also includes signed long for example.


#endif
4 changes: 4 additions & 0 deletions root/meta/naming/issue-18363/selection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<lcgdict>
<class name="reco::PFRecHitSoA"/>
<class name="reco::PFRecHitSoA::View"/>
</lcgdict>
26 changes: 26 additions & 0 deletions root/meta/naming/issue-18363/size_tTemplateNameTest.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
TFile pcmfile("size_tTemplateDict_rdict.pcm");
if (pcmfile.IsZombie()) {
std::cerr << "Error: Failed to open root pcm file: " << pcmfile.GetName() << '\n';
return 1;
}
TObjArray *protoArray = pcmfile.Get<TObjArray>("__ProtoClasses");
if (!protoArray) {
std::cerr << "Error: Failed to retrieve __ProtoClasses\n";
return 2;
}
protoArray->Print();

const char *classname = "reco::PFRecHitSoALayout<128,false>::ViewTemplateFreeParams<128,false,true,true>";
auto cl = TClass::GetClass(classname);
if (!cl) {
std::cerr << "Error: Could not get the TClass for " << classname << "\n";
return 3;
}
if (!cl->IsLoaded()) {
std::cerr << "Error: The TClass is not loaded for " << classname << "\n";
return 4;
}

return 0;
}
5 changes: 5 additions & 0 deletions root/meta/naming/issue-18363/size_tTemplateNameTest.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Processing /Users/pcanal/root_working/roottest/root/meta/naming/issue-18363/size_tTemplateNameTest.C...
Collection name='TObjArray', class='TObjArray', size=16
OBJ: TProtoClass reco::PFRecHitSoALayout<128,false>
OBJ: TProtoClass reco::PFRecHitSoALayout<128,false>::ViewTemplateFreeParams<128,false,true,true>