Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C2603
Collapse the table of content
Expand the table of content

Compiler Error C2603

'function' : Too many block scope static objects with constructor/destructors in function

There is a limit of 31 on the number of static objects you can have in an externally visible inline function.

The following code generates C2603:

// C2603.cpp
struct C { C() {} };
extern inline void f1() {
   static C C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C14,C15,C16;
   static C C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32;
   static C C33;   // C2603 Comment this line out to avoid error
© 2015 Microsoft