[LLVMbugs] [Bug 24257] New: bad sort order for candidates

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 24 14:58:45 PDT 2015


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: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150724/426a001f/attachment.html>


More information about the llvm-bugs mailing list