You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The following code ought to provide an error (it's illegal for a C++ class to have a member and a method with the same name), but doesn't.
# distutils: language = c++# distutils: extra_compile_args = -std=c++11
cdef extern from*:
""" struct A { public: int a(){ return 1; } };"""
cppclass A:
A()
int a # error goes undetectedint a()
cdef A x = A()
print(x.a())
The reason why I'm asking is because there's this SageMath bug sagemath/sage#39092 which actually leads to Cython generates code that contains the literal string <error> (and thus is invalid code), although I haven't been able to find a small example that reproduce the issue yet.
Actually, there are some convoluted cases where it actually works:
# distutils: language = c++# distutils: extra_compile_args = -std=c++11
cdef extern from*:
r""" using F = int(*)(); struct B{ operator int() const{return 1;} operator F() const{return [](){return 2;};} }; struct A { public: B a; };"""
cppclass A:
A()
int a
int a()
cdef A x = A()
print(<int>x.a, x.a())
So anyway, do you think it's reasonable to forbid member and function with the same name entirely?
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The following code ought to provide an error (it's illegal for a C++ class to have a member and a method with the same name), but doesn't.
The reason why I'm asking is because there's this SageMath bug sagemath/sage#39092 which actually leads to Cython generates code that contains the literal string
<error>
(and thus is invalid code), although I haven't been able to find a small example that reproduce the issue yet.Actually, there are some convoluted cases where it actually works:
So anyway, do you think it's reasonable to forbid member and function with the same name entirely?
The text was updated successfully, but these errors were encountered: