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

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #8 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to James K. Lowden from comment #7)
> I am skeptical of the accuracy of the report.  Everything seems to boil down
> to YYLTYPE and YDFLTYPE, which are the same, and hard to get wrong: 

That isn't how YYLTYPE is defined in what gets generated from cdf.y. Instead,
it gets defined as '#define YYLTYPE         YDFLTYPE'. The result is that
'struct copybook_loc_t', after preprocessing, holds an YYLTYPE in some
translation units, but an YDFLTYPE in others. The fact that these structures
hold the same elements is not sufficient to make this valid.

A reduced stand-alone demonstration of this rule is:

a.cc:

  struct A { int i; };
  struct Foo { A x; };

  int f(Foo foo) { return foo.x.i; }

b.cc:

  struct B { int i; };
  #define A B
  struct Foo { A x; };

  int f(Foo foo);
  int main() { return f(Foo{}); }

This triggers the same -Wlto-type-mismatch.

Reply via email to