https://bugs.llvm.org/show_bug.cgi?id=42363

            Bug ID: 42363
           Summary: Diagnostics for "no matching constructor for
                    initialization of ''" could be better
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: lebedev...@gmail.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

https://godbolt.org/z/xxfpk7

struct A {};
struct B {
    explicit B(const A&, int a) {}
};
struct C {
    C(const B&) {}
};

void test(const A& a) {
    C c(a);
}

It rightfully complains that there is no way to convert A to C,
but never mentions the `explicit B(const A&, int a)`, and that it can't be
used because the value for the second argument is not present.


https://godbolt.org/z/EkOmZq
struct A {};
struct B {
    explicit B(const A&, int a = 0) {}
};
struct C {
    C(const B&) {}
};

void test(const A& a) {
    C c(a);
}

Same story, but even more surprising. It took me a moment to realize that
even if there is a default argument in `B`'s constructor,
it still wants it to be passed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to