From: Paolo Carlini Date: Sat, 30 Sep 2017 20:42:05 +0000 (+0000) Subject: re PR c++/65949 (Compiler can not deduce auto type in lambda) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae3f9c32ae1f80e52318318fd749c0237c19e4e8;p=gcc.git re PR c++/65949 (Compiler can not deduce auto type in lambda) 2017-09-30 Paolo Carlini PR c++/65949 * g++.dg/cpp1y/lambda-generic-variadic5.C: New. From-SVN: r253322 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd4688e7916..fcf901a6a4d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-30 Paolo Carlini + + PR c++/65949 + * g++.dg/cpp1y/lambda-generic-variadic5.C: New. + 2017-09-30 Paolo Carlini PR c++/68754 diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic5.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic5.C new file mode 100644 index 00000000000..6dbb9c8e55b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic5.C @@ -0,0 +1,61 @@ +// PR c++/65949 +// { dg-do compile { target c++14 } } + +#include + +template +struct Over : T, Over::type +{ + using type = Over; + + Over(T f1, Ts... f2) + : T(f1), Over::type(f2...) + { + } + + using T::operator(); + using Over::type::operator(); +}; + +template +struct Over : T +{ + using type = T; + using T::operator(); +}; + +template +auto CreateLambdas(Lambdas... lambdas) +{ + return Over(lambdas...); +} + +int main() +{ + auto mesLambda = CreateLambdas + ( + []() + { + + }, + + [](auto i) + { + (void)i; + }, + + [](auto... args) + { + auto list = {args...}; + + for(auto &&a : list) + (void)a; + + return 3; + } + ); + + mesLambda(); + mesLambda(1); + mesLambda(12,24,36,48); +}