mirror of https://github.com/swig/swig
Workaround gcc unnamed type with no linkage error for c++98 standard
This commit is contained in:
parent
6b0f545707
commit
886c6ff729
|
@ -118,12 +118,19 @@ namespace BB {
|
|||
|
||||
|
||||
%inline %{
|
||||
#if defined(SWIG)
|
||||
#define STATIC_FOR_ANONYMOUS
|
||||
#else
|
||||
// For gcc in C++98 mode (at least) to avoid:
|
||||
// error: unnamed type with no linkage used to declare variable ‘<unnamed class> instance’ with linkage
|
||||
#define STATIC_FOR_ANONYMOUS static
|
||||
#endif
|
||||
struct BaseForAnon {
|
||||
virtual ~BaseForAnon() {}
|
||||
};
|
||||
|
||||
// Unnamed nested classes are ignored but were causing code that did not compile
|
||||
class /*unnamed*/ : public BaseForAnon {
|
||||
STATIC_FOR_ANONYMOUS class /*unnamed*/ : public BaseForAnon {
|
||||
int member_var;
|
||||
public:
|
||||
friend int myfriend();
|
||||
|
|
Loading…
Reference in New Issue