title: In C language, is it semantically possible to create an lvalue with incomplete type?
body: <p>In the C89 standard, I found the following section:</p>
  <blockquote>
  <p>3.2.2.1 Lvalues and function designators</p>
  <p>Except when it is the operand of the sizeof operator, the unary &amp; operator, the ++ operator, the -- operator, or the left operand of the . operator or an assignment operator, an lvalue that does not have array type is converted to the value stored in the designated object (and is no longer an lvalue). If the lvalue has qualified type, the value has the unqualified version of the type of the lvalue; otherwise the value has the type of the lvalue. <strong>If the lvalue has an incomplete type and does not have array type, the behavior is undefined</strong>.</p>
  </blockquote>
  <p>If I read it correctly, it allows us to create an <code>lvalue</code> and applies some operators on it, which compiles and can cause undefined behavior during runtime.</p>
  <p>Problem is that, I can't think of an example of &quot;an lvalue with incomplete type&quot; which can pass compiler's semantic check and triggers <code>undefined behavior</code>.</p>
  <p>Consider that an lvalue is</p>
  <blockquote>
  <p>An <strong>lvalue</strong> is an expression (with an object type or an incomplete type other than void) that designates an object.</p>
  </blockquote>
  <p>and that incomplete type is</p>
  <blockquote>
  <p>Types are partitioned into object types (types that describe objects), function types (types that describe functions), and <strong>incomplete types (types that describe objects but lack information needed to determine their sizes)</strong>.</p>
  </blockquote>
  <p>A failed program I tried:</p>
  <pre><code>struct i_am_incomplete;
  int main(void)
  {
      struct i_am_incomplete *p;
      *(p + 1);
      return 0;
  }
  </code></pre>
  <p>and got the following error:</p>
  <pre><code>error: arithmetic on a pointer to an incomplete type 'struct i_am_incomplete'
      *(p + 1);
        ~ ^
  </code></pre>
  <p>Anyone can think of an example on this ? An example of &quot;an lvalue with incomplete type&quot; which can pass compiler's semantic check and triggers <code>undefined behavior</code>.</p>
  <hr />
  <p>UPDATE:</p>
  <p>As @algrid said in the answer, I misunderstood <code>undefined behavior</code>, which contains <code>compile error</code> as an option.</p>
  <p>Maybe I'm splitting hairs, I still wonder the underlying motivation here to prefer <code>undefined behavior</code> over <code>disallowing an lvalue to have an incomplete type</code>.</p>