https://bugs.llvm.org/show_bug.cgi?id=52537

            Bug ID: 52537
           Summary: operator== is not emitted when != is used with
                    templates/member variables involved.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

This problem was encountered with `std::function`, but here's a smaller repro:

```
template <typename T>
struct function {};

template <typename T>
bool operator==(const function<T>&, int) { return true; }

struct S {
  template <typename T>
  bool f() const { return f_ != 0; }

  function<int> f_;
};

int main() {
  return S{}.f<int>();
}
```

This results in:

```
<source>:9: undefined reference to `bool operator==<int>(function<int> const&,
int)'
clang-14: error: linker command failed with exit code 1 (use -v to see
invocation)
```

[Godbolt Repro](https://godbolt.org/z/djG3b4Y6o)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to