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

            Bug ID: 124244
           Summary: [reflection] maybe bogus -Wtautological-compare
                    warning
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

```
#include <meta>
static constexpr std::pair<int, short> p = {1, 2};
static_assert (&[:std::meta::reflect_object (p.first):] == &p.first);
```

compiles fine, but we emit:

w.C:3:57: warning: self-comparison always evaluates to true
[-Wtautological-compare]
    3 | static_assert (&[:std::meta::reflect_object (p.first):] == &p.first);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~

Sure, let's warn for "&p.first == &p.first", but the warning above looks
questionable.

Reply via email to