On Tue, Apr 17, 2018 at 07:39:20AM +0200, Martin Liška wrote:
> +             if (DECL_BIT_FIELD (f1) != DECL_BIT_FIELD (f2))
> +               {
> +                 warn_odr (t1, t2, f1, f2, warn, warned,
> +                           G_ ("one field is bitfield while other is not "));

I think all the G_ uses don't put a space in between G_ and (
Also, please avoid the trailing space in the message.

Do you diagnose if both are bit-fields, but with different bitcount, e.g. if
in your testcase you replace bool mbDisposed : 1; with int mbDisposed : 3;
and bool mbDisposed; with int mbDisposed : 7; ?

> +                 return false;
> +               }
> +             else
> +               gcc_assert (DECL_NONADDRESSABLE_P (f1)
> +                           == DECL_NONADDRESSABLE_P (f2));
>             }
>  
>           /* If one aggregate has more fields than the other, they
> diff --git a/gcc/testsuite/g++.dg/lto/pr85405_0.C 
> b/gcc/testsuite/g++.dg/lto/pr85405_0.C
> new file mode 100644
> index 00000000000..1a41d81099c
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/lto/pr85405_0.C
> @@ -0,0 +1,18 @@
> +// { dg-lto-do link }
> +// { dg-lto-options {{-fPIC -shared -flto}} }
> +
> +class VclReferenceBase { // { dg-lto-warning "7: type 'struct 
> VclReferenceBase' violates the C\\+\\+ One Definition Rule" }
> +  int mnRefCnt;
> +  bool mbDisposed : 1;
> +  virtual ~VclReferenceBase();
> +};
> +class a;
> +class b {
> +  a &e;
> +  bool c();
> +};
> +class B {
> +  VclReferenceBase d;
> +};
> +class a : B {};
> +bool b::c() { return false; }
> diff --git a/gcc/testsuite/g++.dg/lto/pr85405_1.C 
> b/gcc/testsuite/g++.dg/lto/pr85405_1.C
> new file mode 100644
> index 00000000000..78606185624
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/lto/pr85405_1.C
> @@ -0,0 +1,9 @@
> +class VclReferenceBase {
> +  int mnRefCnt;
> +  bool mbDisposed;
> +
> +protected:
> +  virtual ~VclReferenceBase();
> +};
> +class : VclReferenceBase {
> +} a;
> 

        Jakub

Reply via email to