<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62422>62422</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            regression: clang-16 is not packing what seems to be POD
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          stsp
      </td>
    </tr>
</table>

<pre>
    ```
#include <stdio.h>
#include <type_traits>

struct dhdr {
  int a;
};

template<typename T>
class SymWrp : public T {
public:
    SymWrp() = default;
};

struct lol {
  unsigned char _l;
  SymWrp<struct dhdr> _n;
  unsigned char _nj;
} __attribute__((packed));

static_assert(std::is_standard_layout<SymWrp<struct dhdr>>::value, "non-std");
static_assert(std::is_trivial<SymWrp<struct dhdr>>::value, "non-triv");
static_assert(std::is_pod<SymWrp<struct dhdr>>::value, "non-pod");

int main()
{
    printf("%zi\n", sizeof(struct lol));
    return 0;
}
```

Compiling:
```
clang++-16 -Wpacked -Wpacked-non-pod -o p_clng16 pod.cpp
pod.cpp:16:23: warning: not packing field '_n' as it is non-POD for the purposes of layout [-Wpacked-non-pod]
 SymWrp<struct dhdr> _n;
```

So it claims "non-POD for the purposes of layout"
but none of the static_asserts trigger, so the type
is POD.
clang-15 compiles without a warning and produces
the expected results.

What rules are used for "non-POD for the purposes of layout"?
Is it possible that a POD type is "non-POD for the purposes of layout"?

This is an attempt to re-spin #62358 from the
different point of view. In this ticket I assume
the change https://github.com/llvm/llvm-project/commit/277123376ce08c98b07c154bf83e4092a5d4d3c6
was valid and properly justified, but the problem
is in checking the "non-POD for the purposes of layout".

CC @dwblaikie @zygoloid
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVk2v2ywT_TVkM0pkQ_yRRRb3Jo3UVSu1UpcWhrFNi8ECfPOmv_4VtvNxoz5VW8ki2DBzzsycGYV7r1qDuCfZK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