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

            Bug ID: 24257
           Summary: bad sort order for candidates
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: nlewy...@google.com
                CC: dgre...@apple.com, llvmbugs@cs.uiuc.edu
    Classification: Unclassified

$ cat b16776752-1.cc
struct Y {};

struct X {
  X();
  X(const X&) = delete;
  X(const X&&) = delete;
  X(Y&);
};

void test() {
  const Y y{};
  X x2(y);
}
$ clang b16776752-1.cc -std=c++14
b16776752-1.cc:12:5: error: no matching constructor for initialization of 'X'
  X x2(y);
    ^  ~
b16776752-1.cc:5:3: note: candidate constructor not viable: no known conversion
      from 'const Y' to 'const X' for 1st argument
  X(const X&) = delete;
  ^
b16776752-1.cc:6:3: note: candidate constructor not viable: no known conversion
      from 'const Y' to 'const X' for 1st argument
  X(const X&&) = delete;
  ^
b16776752-1.cc:7:3: note: candidate constructor not viable: 1st argument
      ('const Y') would lose const qualifier
  X(Y&);
  ^
b16776752-1.cc:4:3: note: candidate constructor not viable: requires 0
      arguments, but 1 was provided
  X();
  ^
1 error generated.

The two constructors are both non-viable and deleted. The X(Y&) ctor is
non-viable only by a const qualifier, so it should sort ahead of the others.
The deleted ctors should probably sort last.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to