相关疑难解决方法(0)

Overload resolution with ref-qualifiers

While working with ref-qualified function overloads, I'm getting different results from GCC (4.8.1) and Clang (2.9 and trunk). Consider the following code:

#include <iostream>
#include <utility>

struct foo
{
    int& bar() &
    {
        std::cout << "non-const lvalue" << std::endl;
        return _bar;
    }
    //~ int&& bar() &&
    //~ {
    //~     std::cout << "non-const rvalue" << std::endl;
    //~     return std::move(_bar);
    //~ }
    int const& bar() const &
    {
        std::cout << "const lvalue" << std::endl;
        return _bar;
    }
    int const&& bar() const …
Run Code Online (Sandbox Code Playgroud)

c++ overloading language-lawyer c++11 ref-qualifier

20
推荐指数
1
解决办法
2304
查看次数

标签 统计

c++ ×1

c++11 ×1

language-lawyer ×1

overloading ×1

ref-qualifier ×1