title: Why a class with references does not adhere to standard_layout?
body: <p>Executing the following code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  struct s_ref {
      int &amp;foo;
  };
  
  struct s_ptr {
      int *foo;
  };
  
  int main(int argc, char *argv[])
  {
      std::cout &lt;&lt; &quot;s_ref is_standard_layout:&quot; &lt;&lt; std::is_standard_layout&lt;struct s_ref&gt;::value &lt;&lt; std::endl;
      std::cout &lt;&lt; &quot;s_ptr is_standard_layout:&quot; &lt;&lt; std::is_standard_layout&lt;struct s_ptr&gt;::value &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  <p>results in:</p>
  <pre><code>s_ref is_standard_layout:0
  s_ptr is_standard_layout:1
  </code></pre>
  <p>Based on the uses of standard layout (i.e.: &quot;Standard layout types are useful for communicating with code written in other programming languages&quot;) this makes sense, but I'm not sure which is the rule that is violated:</p>
  <blockquote>
  <p>A standard-layout class is a class (defined with class, struct or
  union) that:</p>
  <ul>
  <li><p>has no virtual functions and no virtual base classes.</p>
  </li>
  <li><p>has the same access control (private, protected, public) for all its non-static data members.</p>
  </li>
  <li><p>either has no non-static data members in the most derived class and at most one base class with non-static data members, or has no
  base classes with non-static data members.</p>
  </li>
  <li><p>its base class (if any) is itself also a standard-layout class.</p>
  </li>
  <li><p>And, has no base classes of the same type as its first non-static data
  member.</p>
  </li>
  </ul>
  </blockquote>
  <p><em>Edit</em>: the quote is from: <a href="http://www.cplusplus.com/reference/type_traits/is_standard_layout/" rel="noreferrer">http://www.cplusplus.com/reference/type_traits/is_standard_layout/</a>, but <a href="http://en.cppreference.com/w/cpp/concept/StandardLayoutType" rel="noreferrer">http://en.cppreference.com/w/cpp/concept/StandardLayoutType</a> is also similar.</p>