[Bug c++/71425] New: GCC does not implement C++/WG21 DR 1399/1388
schaub.johannes at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jun 5 19:24:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71425
Bug ID: 71425
Summary: GCC does not implement C++/WG21 DR 1399/1388
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: schaub.johannes at googlemail dot com
Target Milestone: ---
The following testcase should fail to compile because Args is not deduced
(stays empty), but surprisingly, GCC accept it
#include <tuple>
template<class... Args, class T>
T method(std::tuple<Args...>, Args..., T, ...) {
return T();
}
int main() {
method(std::make_tuple<int, float, double>(1, 1.0f, 1.0),
1, 1.0f, 1.0, 1);
}
Here, "Args..." in the "tuple<Args...>" cannot be deduced because DR1388 says
that "Args" is never deduced, because it appears in a non-deduced context in
the second function parameter. GCC however seems to deduce it by the
tuple<...>, and then expands its value into the second function parameter.
However, as Jason notes in DR1399, this is not sensible at all. T will have
been deduced by the first "1", rather than by the last "1". GCC will happily
accept the code if the last "1" is changed to "1.0", with T staying "int".
More information about the Gcc-bugs
mailing list