Sdílet prostřednictvím


Chyba kompilátoru C3852

'member' s typem 'type': agregátní inicializace nemohla inicializovat tento člen

Poznámky

Byl proveden pokus o přiřazení výchozí inicializace jako součást agregační inicializace datovému členu, který nemůže přijmout výchozí inicializaci v agregované inicializaci.

Example

Následující příklad vygeneruje C3852:

// C3852.cpp
struct S
{
   short s;
};

struct S1
{
   int i;
   const S s;
};

struct S2
{
   int i;
   char & rc;
};

int main()
{
   S1 s1 = { 1 };   // C3852 const member
   // try the following line instead
   // S1 s1 = { 1, 2 };

   S2 s2 = { 2 };   // C3852 reference member
   // try the following line instead
   // char c = 'a';
   S2 s2 = { 2, c };
}