# C++: warning: 'X::a' will be initialized after 'X::b' [-Wreorder]

**Code:** `will be initialized after` · **Category:** C/C++ · **Seen on:** C/C++, GCC, Clang

Members are initialised in declaration order, not in the order of the constructor's initialiser list.

## Meaning

If one member's initialiser uses another that is declared later, it reads an uninitialised value. Reorder the list or the declarations.

## Common causes

- Initialiser list order differs from declaration order
- Member depends on a later one

## Quick fix

1. Match the initialiser order to the declaration order
2. Move declarations

## Detailed fix by platform

### GCC / Clang

1. Keep `-Wreorder` on and fix the order

## Code examples

### dependent members

```cpp
struct S { int a; int b; S() : b(1), a(b + 1) {} };   // a initialised first using uninitialised b
```

## How to diagnose

1. **Order** — Same order?
2. **Dependency** — Does one use the other?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/reorder-member-initialization)
