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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs