From: Paolo Carlini Date: Tue, 10 Oct 2017 20:46:26 +0000 (+0000) Subject: re PR c++/78006 (Segmentation fault with 'using' and generic lambda trailing return... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=507ea98d58f471e00a717bc5e21ed8bdd240628b;p=gcc.git re PR c++/78006 (Segmentation fault with 'using' and generic lambda trailing return types) 2017-10-10 Paolo Carlini PR c++/78006 * g++.dg/cpp1y/auto-fn40.C: New. From-SVN: r253621 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14c2a5ad907..b44242014e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-10 Paolo Carlini + + PR c++/78006 + * g++.dg/cpp1y/auto-fn40.C: New. + 2017-10-10 Paolo Carlini PR c++/81032 diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn40.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn40.C new file mode 100644 index 00000000000..e7f1bd44064 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn40.C @@ -0,0 +1,37 @@ +// PR c++/78006 +// { dg-do compile { target c++14 } } + +template T&& declval() noexcept; + +template + struct common_type; + +template + struct common_type<_Tp> + { typedef _Tp type; }; + +template + struct common_type<_Tp, _Up> + { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; }; + +template + struct common_type<_Tp, _Up, _Vp...> + { + typedef typename + common_type::type, _Vp...>::type type; + }; + +template + using common_type_t = typename common_type<_Tp...>::type; + +template +auto x(TFs&&... fs) +{ + using rt = common_type_t; + return [](auto) -> rt { }; +} + +int main() +{ + x([](int){})(0); +}