title: Reference Class Member Triviality
body: <p>Let's say, for reasons of my own, I want a class to have a non-static reference member. I would think that this type should be easily optimized out of most code that uses it. Therefore, I assert its triviality in a unit test.</p>
  
  <p>Clang and GCC agree that the class is trivial, but MSVC disagrees. Who is right, and why, according to the standard? </p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;type_traits&gt;
  
  struct example {
      int&amp; r;
  };
  
  
  // Clang and GCC let this pass
  // MSVC fires this assertion
  static_assert(
      std::is_trivial&lt;example&gt;::value,
      "example is not trivial"
  );
  </code></pre>