Closed shaferandrew closed 9 months ago
Interestingly, this does not seem to affect an enum class
that is declared within an object.
Create "bar.hh" using step 1. above with these contents:
// @trick_parse{everything}
class Bar {
enum class Baz{
a,
b,
c
};
Baz baz{Baz::a};
};
##include "cannon/gravity/include/bar.hh"
)Bar
object in the body (Bar bar{};
)Notice that this will compile. Lines 18-32 of "bar_py.i" are below:
class Bar {
#if SWIG_VERSION > 0x040000
%pythoncode %{
__setattr__ = _swig_setattr_nondynamic_instance_variable(object.__setattr__)
%}
#endif
enum class Baz{
a,
b,
c
};
Baz baz{Baz::a};
};
This issue may only affect an enum class
that is declared outside of an encapsulating class, e.g. just within a namespace.
This is the result of #1288.
convert_swig does not understand an enum class and erroneously matches it as a regular class, adding the code above and causing the error.
Seems to be addressed in recent PR
PR #1603 (commit 763b52f), causes a syntax error when compiling a sim that uses c++
enum class
.To reproduce (using SIM_cannon_analytic as a base):
##include "cannon/gravity/include/foo.hh"
Foo bar{Foo::a};
(it fails to compile even without this line).From "foo_py.i", starting at line 18:
#if...
to...#endif
) and re-running make will complete successfully.I can't find any instances of "enum class" in the Trick testing setup.