← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1393017] Re: error:Field not supported in union.

 

Ok I just find out that , it does not support struct.
but i did not find the tips on wiki.

if i change the type using static_cast instead of union, is the Cheerp
supported?

here are my test file.


// The cheerp/clientlib.h header contains declarations
// for all the browser APIs. 
#include <cheerp/clientlib.h>


class Event
{
public:

	struct sMouseEventStruct
	{
		int windowX;
		int windowY;
		int stageX;
		int stageY;
		int mouseId;
		int mouseKey;
		float pressure; //0-1
	} ;

	struct sKeyboardEventStruct
	{
		int keyCode;
		float pressure; //0-1
		int deviceId;
	};

	struct sUserEventStruct
	{
		int userData0;
		int userData1;
		int userData2;
		int userData3;
		int userData4;
		int userData5;
		int userData6;
		int userData7;
	} ;

public:

	Event (){};
public :
	int type;
protected:
	union
	{
		struct sMouseEventStruct _MouseEvent;
		struct sKeyboardEventStruct _KeyboardEvent;
		struct sUserEventStruct _UserEvent;
		
	} param;
public:	
	Event (int evtid)
	{
		type = evtid;
	}

	struct sUserEventStruct* getUserEventStruct()
	{
		return &param._UserEvent;
	}

	const struct sUserEventStruct* getUserEventStruct() const
	{
		return &param._UserEvent;
	}

};

// webMain is the entry point for web applications written in Cheerp.
void webMain()
{
    Event e;
    // client is a C++ namespace that contains all browser APIs 
    client::console.log("Hello World Wide Web!");
}

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Cheerp.
https://bugs.launchpad.net/bugs/1393017

Title:
  error:Field not supported in union.

Status in Cheerp: C++ for the Web:
  Invalid

Bug description:
  is the error means, cheerp does not support union?

To manage notifications about this bug go to:
https://bugs.launchpad.net/cheerp/+bug/1393017/+subscriptions


References