Skip to content

False positive of uninitialized base in cppcoreguidelines-pro-type-member-init #155416

@chfast

Description

@chfast
struct S;  // forward declaration is needed

struct S
{
     int a;
};

struct C : S
{
    C() : S{0} {}
};
<source>:10:5: warning: constructor does not initialize these bases: S [cppcoreguidelines-pro-type-member-init]
   10 |     C() : S{0} {}
      |     ^
      |           S(),
1 warning generated.

https://godbolt.org/z/7b8cTP7G7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions