This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60943] [C++14] Return type deduction interferes with ref-qualifiers
- From: "anders at sjogren dot info" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 22 May 2015 06:38:38 +0000
- Subject: [Bug c++/60943] [C++14] Return type deduction interferes with ref-qualifiers
- Auto-submitted: auto-generated
- References: <bug-60943-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60943
--- Comment #6 from Anders SjÃgren <anders at sjogren dot info> ---
An alternative test case, which also tests that the correct version is
selected, could be:
#include <type_traits>
using expected_lvalue_res_t = int;
using expected_rvalue_res_t = double;
struct A {
auto f() & {return expected_lvalue_res_t{};}
auto f() && {return expected_rvalue_res_t{};}
};
void lvalue_assert()
{
A a;
a.f();
static_assert(std::is_same<decltype(a.f()),
expected_lvalue_res_t>::value,"");
}
void rvalue_assert()
{
A{}.f();
static_assert(std::is_same<decltype(A{}.f()),
expected_rvalue_res_t>::value,"");
}