Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. error on webrtc base/sigslot.h file: error: expected ')' before '...' token void emit(Args... args) const

error on webrtc base/sigslot.h file: error: expected ')' before '...' token void emit(Args... args) const

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 5 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NabiN Offline
    NabiN Offline
    Nabi
    wrote on last edited by VRonin
    #1

    Hi everone!
    I'm trying to use google webrtc api, but I got some errors on sigslot.h file while compiling project. Error on this class:

    class _opaque_connection
    	{
    	private:
    		typedef void (*emit_t)(const _opaque_connection*);
    		template< typename FromT, typename ToT >
    		union union_caster
    		{
    			FromT from;
    			ToT to;
    		};
    
    		emit_t pemit;
    		has_slots_interface* pdest;
    		// Pointers to member functions may be up to 16 bytes for virtual classes,
    		// so make sure we have enough space to store it.
    		unsigned char pmethod[16];
    
    	public:
    		template< typename DestT, typename ... Args >
    		_opaque_connection(DestT* pd, void (DestT::*pm)(Args...)) : pdest(pd)
    		{
    			typedef void (DestT::*pm_t)(Args...);
    			static_assert(sizeof(pm_t) <= sizeof(pmethod), "Size of slot function pointer too large.");
    
    			std::memcpy(pmethod, &pm, sizeof(pm_t));
    
    			typedef void (*em_t)(const _opaque_connection* self, Args...);
    			union_caster< em_t, emit_t > caster2;
    			caster2.from = &_opaque_connection::emitter< DestT, Args... >;
    			pemit = caster2.to;
    		}
    
    		has_slots_interface* getdest() const { return pdest; }
    
    		_opaque_connection duplicate(has_slots_interface* newtarget) const
    		{
    			_opaque_connection res = *this;
    			res.pdest = newtarget;
    			return res;
    		}
    
    		// Just calls the stored "emitter" function pointer stored at construction
    		// time.
    		template< typename ... Args >
    		void emit(Args... args) const
    		{
    			typedef void (*em_t)(const _opaque_connection*, Args...);
    			union_caster< emit_t, em_t > caster;
    			caster.from = pemit;
    			(caster.to)(this, args...);
    		}
    
    	private:
    		template< typename DestT, typename ... Args >
    		static void emitter(const _opaque_connection* self, Args... args)
    		{
    			typedef void (DestT::*pm_t)(Args...);
    			pm_t pm;
    			std::memcpy(&pm, self->pmethod, sizeof(pm_t));
    			(static_cast< DestT* >(self->pdest)->*(pm))(args...);
    		}
    	};
    

    error:

    expected ')' before '...' token
       void emit(Args... args) const
                     ^
    

    what is wrong?
    HELP

    JonBJ 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Don't know what this has to do with Qt but I suppose it might be a naming clash, see http://doc.qt.io/qt-5/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • NabiN Nabi

        Hi everone!
        I'm trying to use google webrtc api, but I got some errors on sigslot.h file while compiling project. Error on this class:

        class _opaque_connection
        	{
        	private:
        		typedef void (*emit_t)(const _opaque_connection*);
        		template< typename FromT, typename ToT >
        		union union_caster
        		{
        			FromT from;
        			ToT to;
        		};
        
        		emit_t pemit;
        		has_slots_interface* pdest;
        		// Pointers to member functions may be up to 16 bytes for virtual classes,
        		// so make sure we have enough space to store it.
        		unsigned char pmethod[16];
        
        	public:
        		template< typename DestT, typename ... Args >
        		_opaque_connection(DestT* pd, void (DestT::*pm)(Args...)) : pdest(pd)
        		{
        			typedef void (DestT::*pm_t)(Args...);
        			static_assert(sizeof(pm_t) <= sizeof(pmethod), "Size of slot function pointer too large.");
        
        			std::memcpy(pmethod, &pm, sizeof(pm_t));
        
        			typedef void (*em_t)(const _opaque_connection* self, Args...);
        			union_caster< em_t, emit_t > caster2;
        			caster2.from = &_opaque_connection::emitter< DestT, Args... >;
        			pemit = caster2.to;
        		}
        
        		has_slots_interface* getdest() const { return pdest; }
        
        		_opaque_connection duplicate(has_slots_interface* newtarget) const
        		{
        			_opaque_connection res = *this;
        			res.pdest = newtarget;
        			return res;
        		}
        
        		// Just calls the stored "emitter" function pointer stored at construction
        		// time.
        		template< typename ... Args >
        		void emit(Args... args) const
        		{
        			typedef void (*em_t)(const _opaque_connection*, Args...);
        			union_caster< emit_t, em_t > caster;
        			caster.from = pemit;
        			(caster.to)(this, args...);
        		}
        
        	private:
        		template< typename DestT, typename ... Args >
        		static void emitter(const _opaque_connection* self, Args... args)
        		{
        			typedef void (DestT::*pm_t)(Args...);
        			pm_t pm;
        			std::memcpy(&pm, self->pmethod, sizeof(pm_t));
        			(static_cast< DestT* >(self->pdest)->*(pm))(args...);
        		}
        	};
        

        error:

        expected ')' before '...' token
           void emit(Args... args) const
                         ^
        

        what is wrong?
        HELP

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Nabi
        You have line:

        void emit(Args... args) const

        in your code. I'm not a C++ expert, but is that really legal?

        Alternatively, if you are posting here because you have also included Qt header files into your source file, be aware that Qt defines, I believe, an emit as a macro (which expands to nothing, I think), and that just might be interfering with the emit() you have here?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JonB Yes it is. See parameter pack.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          JonBJ 1 Reply Last reply
          0
          • SGaistS SGaist

            @JonB Yes it is. See parameter pack.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @SGaist
            C++ is getting (even more) ridiculous then!

            So given OP's compiler error message, what's wrong then?! Wrong compiler C++ version? emit defined as a macro by Qt if OP has included a Qt header file, since he's posting on a Qt forum? C++ just feeling grumpy/having a bad-hair day?

            jsulmJ 1 Reply Last reply
            0
            • JonBJ JonB

              @SGaist
              C++ is getting (even more) ridiculous then!

              So given OP's compiler error message, what's wrong then?! Wrong compiler C++ version? emit defined as a macro by Qt if OP has included a Qt header file, since he's posting on a Qt forum? C++ just feeling grumpy/having a bad-hair day?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @JonB Yes, I think he simply has a naming clash as @VRonin already suggested, not C++ issue :-)

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved