Question about is_standard_layout

According to, this should report true:

#include <type_traits>

struct Base {
int b_a;

struct Foo : Base {
int a;

int main()
std::cout << std::boolalpha;
std::cout << "Base " << std::is_standard_layout::value << “\n”;
std::cout << "Foo " << std::is_standard_layout::value << “\n”;

1103_ clang++ -std=c++14 /tmp/XXX.cpp -o /tmp/XXX
1104_ /tmp/XXX
Base true
Foo false
1105_ clang++ --version
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/

Or is this just an Apple/Clang thing and I should complain to them?


David Barto | Principal Engineer

This class doesn’t meet the definition of “standard layout” due to violating the 6th bullet point:

“Has all non-static data members and bit-fields declared in the same class (either all in the derived or all in some base)”

“Foo” has one member declared in “Foo” and one member declared in its base “Base”.