From 660f3dc7ddd5e02e9922ecf94c1b17b72101476c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 24 Nov 2015 18:16:26 +0000 Subject: [PATCH] re PR c++/68388 (incomplete type bug when using decltype) 2015-11-24 Paolo Carlini PR c++/68388 * g++.dg/cpp1y/pr68388.C: New. From-SVN: r230827 --- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/cpp1y/pr68388.C | 42 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr68388.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5fcb76941b0..ab038201b2b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-24 Paolo Carlini + + PR c++/68388 + * g++.dg/cpp1y/pr68388.C: New. + 2015-11-24 Aditya Kumar Sebastian Pop diff --git a/gcc/testsuite/g++.dg/cpp1y/pr68388.C b/gcc/testsuite/g++.dg/cpp1y/pr68388.C new file mode 100644 index 00000000000..f1a342a43bd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr68388.C @@ -0,0 +1,42 @@ +// { dg-do compile { target c++14 } } + +namespace std { +typedef int size_t; +template +struct index_sequence {}; +} + +template class Tuple {}; + +template +auto get(Tuple) { + return TFirst(); +} + +template +auto apply_impl(Functor f, T1 t1, T2 t2) { + return f(get(t1), get(t2)); +} + +template +auto map_impl(std::index_sequence, Functor f, T1 t1, T2 t2) { + Tuple(f, t1, t2))...>(); +} + +template +auto map_impl(Functor f, T1 t1, T2 t2) { + map_impl(std::index_sequence<0>(), f, t1, t2); +} + +struct Less { + template + auto operator()(Lhs lhs, Rhs rhs) -> decltype(lhs < rhs) { + return lhs < rhs; + } +}; + +int main() { + auto t1 = Tuple(); + auto t2 = Tuple(); + map_impl(Less(), t1, t2); +} -- 2.30.2