-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
| Bugzilla Link | 24257 |
| Version | unspecified |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor |
Extended Description
$ cat b16776752-1.ccstruct 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.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer