Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 854 Bytes

compiler-warning-level-1-c4269.md

File metadata and controls

30 lines (24 loc) · 854 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 1) C4269
Compiler Warning (level 1) C4269
11/04/2016
C4269
C4269
96c97bbc-068a-4b65-8cd8-4ed5dca04c15

Compiler Warning (level 1) C4269

'identifier' : 'const' automatic data initialized with compiler generated default constructor produces unreliable results

A const automatic instance of a non-trivial class is initialized with a compiler-generated default constructor.

Example

// C4269.cpp
// compile with: /c /LD /W1
class X {
public:
   int m_data;
};

void g() {
   const X x1;   // C4269
};

Since this instance of the class is generated on the stack, the initial value of m_data can be anything. Also, since it is a const instance, the value of m_data can never be changed.