Class member function shadowing

Hi guys. I’ve been testing the shadowing functions, it works fine in many cases. But I checked one variant where it doesn’t work:

[cling]$ class F { private: void f(); };
[cling]$ void F::f() { int c = 1; }
[cling]$ void F::f() { int c = 1; }

I get this output:
input_line_9:1:9: error: redefinition of 'f

Tested on master

Hi @And_Or and thanks for the report! @jalopezg any comments? :slight_smile: This one looks … nasty!

Hi @And_Or,

This is a known issue. As a workaround, shadowing of member functions defined out-of-line can be performed after also redefining the class, i.e.

[cling]$ class F { private: void f(); };
[cling]$ void F::f() { int c = 1; }
[cling]$ class F { private: void f(); };
[cling]$ void F::f() { int c = 1; /* ... */ }

In any case, my plans are to use some spare time this year to improve redefinition support… :slight_smile:

Cheers,
J.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.