Non-const copy constructor and implicit conversions on return value

前端 未结 4 721
长发绾君心
长发绾君心 2020-12-31 23:51

Consider the following C++ code:

struct B { };
struct A
{
        A(int);
        A(A&); // missing const is intentional
        A(B);
        operator B         


        
4条回答
  •  难免孤独
    2021-01-01 00:19

    The error lists all the potential candidates to be used, and why they cannot be used. It lists the conversion from B because its one of the constructors, but it doesn't know how to use it in this case, so it doesn't.

提交回复
热议问题