[llvm-bugs] [Bug 52537] New: operator== is not emitted when != is used with templates/member variables involved.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 17 12:15:15 PST 2021
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: unassignedclangbugs at nondot.org
Reporter: mcypark at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211117/584e289b/attachment.html>
More information about the llvm-bugs
mailing list