title: Use of Union with reference
body: <p>At work I've been using linux and the GCC compiler for C++11 and C++14. In some of the code at work, I've used a union to store both a reference and a pointer, as so: (Simplified to just the important parts)</p>
  
  <pre><code>struct MyStruct
  {
      //Stuff
      union { double&amp; x; double* x_ptr; };
      MyStruct(double&amp; value) : x(value) {}
      //More stuff
  };
  </code></pre>
  
  <p>I believe this code is clear, readable, unambiguous, and provides a convenient way to store references which can be shifted to something else. It provides easily understandable syntactic sugar without costing performance while improving readability. When I attempted to use code like this in visual studio 15, however, the code failed to compile due to "an illegal union member of type double&amp;".</p>
  
  <ol>
  <li>Is this code illegal under the standard, or just under Visual Studio 2015?</li>
  <li>Can I MAKE it compile in Visual Studio 2015, or submit a bug report/change request/something?</li>
  <li>Is use of a union in that way bad practice?</li>
  </ol>
  
  <p>Note: At my work, pretty much all code is written for Linux and compiled with GCC, and for my specific project, C++11 is guaranteed and GCC is the only compiler that's going to be used. </p>
  
  <p><strong>Edit:</strong> Please don't tell me that putting a reference inside a union "has no meaning". When a reference is stored inside a struct, it takes up the same amount of space as a pointer. In addition, the following compiles with clang:</p>
  
  <pre><code>struct MyStruct
  {
      //This will compile
      union 
      { 
          struct { double&amp; x; }; 
          double* x_ptr; 
      };
      //This won't compile; WHY?
      /*union 
      { 
          double&amp; x;
          double* x_ptr; 
      };*/
      MyStruct(double&amp; val) : x(val){}
      void Repoint(double&amp; new_value) 
      { 
          x_ptr = &amp;new_value; 
      }
  };
  </code></pre>
  
  <p>Why does it compile when the reference is wrapped in an anonymous struct, but not when it's just in the union?</p>
  
  <p><kbd><a href="http://coliru.stacked-crooked.com/a/918a7b3d1652e112" rel="noreferrer">live example</a></kbd></p>