-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Wrong function overload selection with long inheritance chain #8817
Copy link
Copy link
Closed
Labels
Description
Describe the bug
There seems to be a bug in the selection of a function overload with TObject-derived classes from Python:
import ROOT
ROOT.gInterpreter.Declare(
'''
class A: public TObject {};
class B: public A {};
void myfunc(const A &a){
std::cout << "A" << std::endl;
}
void myfunc(const B &b){
std::cout << "B" << std::endl;
}
''')
ROOT.myfunc(ROOT.A())
ROOT.myfunc(ROOT.B())The snippet above outputs
A
A
Expected behavior
Snippet should output A\nB, And indeed from the root prompt I get the correct output
root [0] class A: public TObject {};
root [1] class B: public A {};
root [2] void myfunc(const A &a){
root (cont'ed, cancel with .@) [3] std::cout << "A" << std::endl;
root (cont'ed, cancel with .@) [4]}
root [5]
root [5] void myfunc(const B &b){
root (cont'ed, cancel with .@) [6] std::cout << "B" << std::endl;
root (cont'ed, cancel with .@) [7]}
root [8] myfunc(A{});
A
root [9] myfunc(B{});
BSetup
I tried it with both ROOT 6.24/02 and 6.20/06 (to check against old PyROOT), installed with conda on a Fedora32 machine
Reactions are currently unavailable