[LLVMbugs] [Bug 8334] Wrong template parameter is used for default copy constructor of template class
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Nov 14 21:42:44 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=8334
Douglas Gregor <dgregor at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |INVALID
--- Comment #6 from Douglas Gregor <dgregor at apple.com> 2010-11-14 23:42:43 CST ---
(In reply to comment #5)
> This testcase fails in clang++ and succeeds in gcc. You are saying that they
> both do the same thing. This doesn't make sense.
>
> Possible solutions can be:
> 1. gcc and clang++ both succeed or both fail for me, then please provide
> versions of both.
> 2. gcc is wrong and clang++ is right, please explain why.
> 3. bug is fixed in clang++.
>
> This case is taken from the working project that only compiles under gcc and
> not clang.
Both clang++ and g++ 4.2 reject this code in the same way, because there is no
suitable operator != for my_alloc instances. Clang and g++ both provide good
diagnostics, and the fix to your code is trivial. Just add:
template<typename T1>
bool operator!=(const my_alloc<T1> &other) const { return (this != &other);
}
into the my_alloc class and it works with both compilers.
If you found some version of g++ that worked, it's probably because that
standard library version uses == rather than != on allocators.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list