https://llvm.org/bugs/show_bug.cgi?id=27374
Bug ID: 27374
Summary: The implicit version tuple's
"reduced-arity-initialization" extension breaks
conforming code.
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
This bug tracks LWG issue #2419
(http://cplusplus.github.io/LWG/lwg-active.html#2419)
Calls to foo(v) can implicitly construct a n-tuple where n > 1 due to libc++'s
tuple extensions. This can cause overload resolution for foo(v) to select a
different overload than would otherwise be choosen for a conforming tuple
implementation. For example:
#include <iostream>
#include <tuple>
struct base
{
void out(const std::tuple<char, char>& w) const
{
std::cerr << "Tuple: " << std::get<0>(w) << std::get<1>(w) << '\n';
}
};
struct decorator
{
base b_;
template <typename... Args>
auto
out(Args&&... args)
-> decltype(b_.out(args...))
{
return b_.out(args...);
}
void out(const char& w)
{
std::cerr << "char: " << w << '\n';
}
};
int main()
{
decorator d{base{}};
char l = 'a';
d.out(l);
}
Libc++'s tuple will cause this program to print "Tuple: a" where it should
actually print "char: a".
The fix for this problem is to remove the extension on the implicit version of
the UTypes... constructors.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs