https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88647

--- Comment #4 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(In reply to jos...@codesourcery.com from comment #1)
> 6.3.2.1#2 (conversion of lvalues to rvalues): "If the lvalue has an 
> incomplete type and does not have array type, the behavior is undefined.".  
> Cf. bug 36941 (noting how DR#106 confuses things by allowing dereferences 
> of pointers to qualified void).

(Incorrectly added an additional comment instead of replying)

What about this modified test case?

  struct S *p;

  void f(void);

  int main()
  {
    f();

    &*p;
  }

  struct S { int x; };

  void f()
  {
    static struct S s = { 0 };
    p = &s;
  }

It gives the same error message (using the same compilation command line), and
there is no lvalue to rvalue conversion of *p in this case, because of the
operator & .

Clang accept that test case without any errors.

Reply via email to