Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error C3397

Aggregate initialization is not allowed in default arguments

An array was declared incorrectly. See array (Visual C++) for more information.

The following sample generates C3397.

// C3397.cpp
// compile with: /clr
// /clr /c
void Func(array<int> ^p = gcnew array<int> { 1, 2, 3 });   // C3397
void Func2(array<int> ^p = gcnew array<int> (3));   // OK

int main() {
   array<int> ^p = gcnew array<int> { 1, 2, 3};   // OK
}
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.