https://bugs.llvm.org/show_bug.cgi?id=45634
Bug ID: 45634
Summary: Missing -Wdeprecated warning when user-declared copy
assignment operator is defined as deleted
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: arthur.j.odw...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
// https://godbolt.org/z/vmKAwd
struct S {
int i;
S& operator=(const S&) = delete;
};
S test(const S& s) { return S(s); }
"clang++ -Wdeprecated test.cc" (incorrectly) does not emit a warning for this
code.
It will (correctly) emit a warning if you remove the tokens "= delete" from the
user-provided declaration.
http://eel.is/c++draft/class.copy.ctor#6 :
> If the class definition does not explicitly declare a copy constructor, a
> non-explicit one is declared implicitly. If the class definition declares a
> move constructor or move assignment operator, the implicitly declared copy
> constructor is defined as deleted; otherwise, it is defined as defaulted
> ([dcl.fct.def]). The latter case is deprecated if the class has a
> user-declared copy assignment operator or a user-declared destructor
> ([depr.impldec]).
S's deleted copy assignment operator counts as a user-declared copy assignment
operator; therefore we're in the deprecated case; therefore Clang should warn.
(So says #standardese on Slack, anyway.)
--
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