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

            Bug ID: 92384
           Summary: Empty class instances have different equal testing
                    result among GCC versions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael.hliao at gmail dot com
  Target Milestone: ---

Created attachment 47177
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47177&action=edit
sources and compilation script

Instances of an empty class should be regarded as different objects. Equal
testing should return false. However, equal testing through a function has
different results from gcc-7 to gcc-9.

The test code

```
#include <iostream>

class Empty {};

bool is_same(Empty a, Empty b);

int main() {
  Empty a, b;

  if (&a == &b)
    std::cout << "SAME EMPTY\n";
  else
    std::cout << "DIFF EMTPY\n";

  if (is_same(a, b))
    std::cout << "SAME EMPTY\n";
  else
    std::cout << "DIFF EMTPY\n";
}
```

equal-test| gcc-7 | gcc-8 | gcc-9
----------+-------+-------+------
inline    | DIFF  | DIFF  | DIFF
function  | DIFF  | SAME  | SAME

find the source and compilation scripts in the attachment.

Reply via email to