Skip to content

[PyROOT] Segfault when creating proxy to derived class with multiple overloads #7686

@stwunsch

Description

@stwunsch

Following reproducer fails with a segfault:

import cppyy

cppyy.cppdef('''
struct Base {
    float data;
    float& operator[](int idx) { return data; }
};

struct Derived: public Base {
    float data;

    // Note that you have to derive from Base to make it break!
    float& operator[](int idx) { return data; }

    // Note that you must put the template here!
    template <typename T>
    float& operator[](int idx) { return data; }
};
''')

cppyy.gbl.Derived()

There's a corresponding issue submitted to upstream cppyy: https://bitbucket.org/wlav/cppyy/issues/334/segfault-when-creating-proxy-to-derived

This issues were found in the wake of RVec 2.0 (#7502) and may just scratch the surface of an issue in cppyy with picking up methods from derived classes. See the workarounds for operator[] and size in RVec 2.0 to avoid this problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions