Commit 5b93c0ee by Paolo Carlini Committed by Paolo Carlini

re PR c++/80471 ((gcc extension) Forwarding-reference `auto` function parameters…

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
parent 25139006
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.
......
// 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& >, "");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment