diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2017-10-04 21:25:20 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2017-10-04 21:25:20 +0000 |
commit | 5b93c0eede070f8f3a6ce4a394937311c33df550 (patch) | |
tree | 4828cb8b126dd4752e9222a68aedb8150ff8673f | |
parent | 25139006e58a7ca7b708a742af8170f399d7db63 (diff) | |
download | gcc-5b93c0eede070f8f3a6ce4a394937311c33df550.zip gcc-5b93c0eede070f8f3a6ce4a394937311c33df550.tar.gz gcc-5b93c0eede070f8f3a6ce4a394937311c33df550.tar.bz2 |
re PR c++/80471 ((gcc extension) Forwarding-reference `auto` function parameters do not follow the same rules as template functions or generic lambdas)
2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/80471
* g++.dg/cpp1y/pr80471.C: New.
From-SVN: r253432
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/pr80471.C | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1e3edc..bd4133b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/80471 + * g++.dg/cpp1y/pr80471.C: New. + +2017-10-04 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/78131 * g++.dg/cpp1z/constexpr-lambda17.C: New. diff --git a/gcc/testsuite/g++.dg/cpp1y/pr80471.C b/gcc/testsuite/g++.dg/cpp1y/pr80471.C new file mode 100644 index 0000000..bca4022 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr80471.C @@ -0,0 +1,23 @@ +// PR c++/80471 +// { dg-do compile { target c++14 } } +// { dg-options "" } + +template <class, class> +constexpr bool is_same = false; +template <class T> +constexpr bool is_same<T, T> = true; + +template<class T> +decltype(auto) f(T&& a){return a;} + +decltype(auto) g(auto&& a){return a;} + +auto z = [](auto&& a) -> decltype(auto) { return a; }; + +int main() +{ + int i; + static_assert(is_same< decltype(f(i)), int& >, ""); + static_assert(is_same< decltype(g(i)), int >, ""); + static_assert(is_same< decltype(z(i)), int& >, ""); +} |