Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyROOT doesn't work with templated binary operator implementations like operator+ #15378

Open
guitargeek opened this issue Apr 29, 2024 · 0 comments
Assignees

Comments

@guitargeek
Copy link
Contributor

guitargeek commented Apr 29, 2024

Description

Operators like operator+ don't work in cppyy if they are implemented as template functions.

Reproducer

import cppyy

cppyy.cppdef("""

template<class T>
struct Foo {
    Foo(T v) : val{v} {}
    T val;
};

template <class T>
Foo<T> operator+(Foo<T> const &a, Foo<T> const &b)
{
   return Foo<T>{a.val + b.val};
}

""")

klass = cppyy.gbl.Foo["int"]

a = klass(4)
b = klass(7)

a + b

ROOT version

At least ROOT 6.04 according to original Jira ticket:
https://its.cern.ch/jira/browse/ROOT-7717

Installation method

Build master from source

Operating system

Arch Linux

Additional context

  • same problem as reported in ROOT-7717, but with a simplified reproducer
  • reproducer works with upstream cppyy, so the problem is likely related to the cppyy-backend (e.g. ROOT meta or CallFunc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant