fork(6) download
  1. #include <cstddef>
  2. #include <iomanip>
  3. #include <iostream>
  4. #include <type_traits>
  5.  
  6. struct EB { };
  7.  
  8. struct S1 : EB {
  9. EB eb;
  10. int a;
  11. char b;
  12. };
  13.  
  14. struct S3 : S1 {
  15. char c;
  16. };
  17.  
  18. int main()
  19. {
  20. std::cout << sizeof(S1) << "\n";
  21. std::cout << sizeof(S3) << "\n";
  22. std::cout << std::boolalpha << std::is_standard_layout<S1>::value << "\n";
  23. std::cout << std::boolalpha << std::is_standard_layout<S3>::value << "\n";
  24. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
12
12
false
false