नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'var': you cannot capture a member of an anonymous union
Remarks
You cannot capture a member of an unnamed union.
To correct this error
- Give the union a name and pass the complete union structure to the capture list of the lambda expression.
Example
The following example generates C3492 because it captures a member of an anonymous union:
// C3492a.cpp
int main()
{
union
{
char ch;
int x;
};
ch = 'y';
[&x](char ch) { x = ch; }(ch); // C3492
}
The following example resolves C3492 by giving the union a name and by passing the complete union structure to the capture list of the lambda expression:
// C3492b.cpp
int main()
{
union
{
char ch;
int x;
} u;
u.ch = 'y';
[&u](char ch) { u.x = ch; }(u.ch);
}