Skip to content

NewVrtSecInclusiveTool: fix compilation error in debug

build/atnight/localbuilds/nightlies/master/athena/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Sel2TrkVertices.cxx:76: undefined reference to `Rec::NewVrtSecInclusiveTool::DevTuple::maxNTrk'
collect2: error: ld returned 1 exit status

This is a bit subtle and prb my wording here would not be exact.

  • The maxNTrk seems to be used mainly as an integral constant
  • But when passed to std::min one takes a const ref. So here one needs address
  • There is subtle points on declaration / definition namespace scope/ and one definition rule use among translation units when this is happening.

This might help a bit with the terminology: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbclx01/cplr038.htm

or better here: https://en.cppreference.com/w/cpp/language/static#Static_data_members (there are subtle wording diff until and since C++17)

Trying to puts thing together

  1. If a const non-inline static data member is odr-used, a definition at namespace scope is still required, but it cannot have an initializer.
  2. If a static data member is declared constexpr, it is implicitly inline and does not need to be redeclared at namespace scope. This redeclaration without an initializer (formerly required as shown above) is still permitted, but is deprecated.

So here the 1st is changed to the 2nd. but @vkost please take a look. The real subtle point was when you tried to pass a reference of this around i.e "use" it....

Edited by Christos Anastopoulos

Merge request reports