title: Designated initializers in C++20
body: <p>I've got a question about one of the c++20 feature, designated initializers (more info about this feature <a href="https://en.cppreference.com/w/cpp/language/aggregate_initialization" rel="noreferrer">here</a>)</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  constexpr unsigned DEFAULT_SALARY {10000};
  
  struct Person
  {
      std::string name{};
      std::string surname{};
      unsigned age{};
  };
  
  struct Employee : Person
  {
      unsigned salary{DEFAULT_SALARY};
  };
  
  int main()
  {
      std::cout &lt;&lt; std::boolalpha &lt;&lt; std::is_aggregate_v&lt;Person&gt; &lt;&lt; '\n'; // true is printed
      std::cout &lt;&lt; std::boolalpha &lt;&lt; std::is_aggregate_v&lt;Employee&gt; &lt;&lt; '\n'; // true is printed
  
      Person p{.name{"John"}, .surname{"Wick"}, .age{40}}; // it's ok
      Employee e1{.name{"John"}, .surname{"Wick"}, .age{40}, .salary{50000}}; // doesn't compile, WHY ?
  
      // For e2 compiler prints a warning "missing initializer for member 'Employee::&lt;anonymous&gt;' [-Wmissing-field-initializers]"
      Employee e2 {.salary{55000}}; 
  }
  </code></pre>
  
  <p>This code was compiled with gcc 9.2.0 and <code>-Wall -Wextra -std=gnu++2a</code> flags. </p>
  
  <p>As you can see above, both structs, <code>Person</code> and <code>Employee</code> are aggregates but initialization of <code>Employee</code> aggregate isn't possible using designated initializers.</p>
  
  <p>Could someone explain me why ?</p>