Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 1.01 KB

File metadata and controls

35 lines (28 loc) · 1.01 KB
title C26495
ms.date 03/22/2018
ms.topic reference
f1_keywords
C26495
helpviewer_keywords
C26495
description CppCoreCheck rule that enforces C++ Core Guidelines Type.6

C26495 MEMBER_UNINIT

Variable '%variable%' is uninitialized. Always initialize a member variable (type.6).

See also

C++ Core Guidelines Type.6 and C.48

Example

struct MyStruct
{
    int value;
    MyStruct() {}; // C26495, MyStruct::value is uninitialized
};

To fix the warning, add in-class initializers to all of the member variables. See the above linked C++ Core Guidelines pages for additional information.

struct MyStruct
{
    int value{};
    MyStruct() {}; // no warning, MyStruct::value is set via default member initialization
};