[LLVMbugs] [Bug 20092] New: Unqualified calls of std::get lead to ADL issues
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jun 20 20:03:23 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20092
Bug ID: 20092
Summary: Unqualified calls of std::get lead to ADL issues
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: kaballo86 at hotmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
Created attachment 12689
--> http://llvm.org/bugs/attachment.cgi?id=12689&action=edit
proposed fix
Several calls to `std::get<I>` are unqualified within the implementation, which
leads to ADL related issues such as resolving to user-defined overloads:
#include <tuple>
#include <utility>
namespace foo {
struct bar { bool operator==(bar) const { return true; } };
template <std::size_t I>
void get(std::tuple<foo::bar, int>) {}
}
int main()
{
std::tuple<foo::bar, int> t1, t2;
t1 == t2; // error: invalid operands to binary expression ('void' and
'void')
}
or perhaps less contrivedly triggering hard errors during overload resolution:
#include <tuple>
#include <utility>
namespace foo {
struct bar { bool operator==(bar) const { return true; } };
template <std::size_t I>
struct hard_error { static_assert(I > 0, ""); using type = void; };
template <std::size_t I, typename T>
typename hard_error<I>::type get(T) {}
}
int main()
{
std::tuple<foo::bar, int> t1, t2;
t1 == t2; // error: static_assert failed ""
// note: in instantiation of template class
'foo::hard_error<0>'
// note: while substituting explicitly-specified template
arguments into function template 'get'
}
--
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/20140621/eaccd0cb/attachment.html>
More information about the llvm-bugs
mailing list