title: Is pointer arithmetic on inactive member of a union UB?
body: <p>Let's consider this example code:</p>
  
  <pre><code>struct sso
  {
      union {
          struct {
              char* ptr;
              char size_r[8];
          } large_str;
          char short_str[16];
      };
  
      const char* get_tag_ptr() const {
          return short_str+15;
      }
  };
  </code></pre>
  
  <p>In <a href="https://timsong-cpp.github.io/cppwp/n4659/expr.add#4" rel="noreferrer">[basic.expr]</a> it is specified that pointer arithmetic is allowed as long as the result points to another element of the array (or past the end of an object or of the last element). Nevertheless it is not specified in this setion what happens if the array is an inactive member of a union. I believe it is not an issue <code>short_str+15</code> is never UB. Is it right?</p>
  
  <p><sub> <a href="https://stackoverflow.com/questions/48189026/using-stdlaunder-to-get-a-pointer-to-an-active-object-member-from-a-pointer-to">The following question</a> clearly showes my intent</sub></p>