RSS
Follow Us
Contribute
 
 
 
 

Error C3918: usage requires (member) to be a data member

 
We need YOUR SKILLS in this collaborative work, to build the largest solution center for error messages.

From $1

Table of contents
  1. 1. Cause
  2. 2. Solution
  3. 3. (ToDo)
  4. 4. About This Article

Cause

This error is generated if you try to check a trivial event for null (the event name will no longer provide direct access to the backing store delegate for the event). Ex:

// compile with: /clr /c
using namespace System;
public delegate int MyDel(int);

interface struct IEFace {
   event MyDel ^ E;
};

ref struct EventSource : public IEFace {
   virtual event MyDel ^ E;
   void Fire_E(int i) {
      if (E)   // C3918
         E(i);
   }
};

Solution

 

(ToDo)

Write the solution section and give other code examples that may trigger this error to improve the article.

About This Article

This article is a derivative work based on Compiler Error C3918 which is provided by MSDN Community Content - Visual C++.

 
 
 
 
Comments