Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 670 Bytes

compiler-error-c2571.md

File metadata and controls

28 lines (22 loc) · 670 Bytes
descriptiontitlems.datef1_keywordshelpviewer_keywordsms.assetid
Learn more about: Compiler Error C2571
Compiler Error C2571
11/04/2016
C2571
C2571
c6522616-dee9-4d7d-9bf8-30a7e1deaadf

Compiler Error C2571

'function' : virtual function cannot be in union 'union'

A union is declared with a virtual function. You can declare a virtual function only in a class or structure. Possible resolutions:

  1. Change the union to a class or structure.

  2. Make the function nonvirtual.

The following sample generates C2571:

// C2571.cpp// compile with: /cunion A { virtualvoidfunc1(); // C2571voidfunc2(); // OK };
close