<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 29, 2014 at 5:28 PM, Arthur O'Dwyer <span dir="ltr"><<a href="mailto:arthur.j.odwyer@gmail.com" target="_blank">arthur.j.odwyer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Tue, Apr 29, 2014 at 6:58 AM, Alexander Kornienko <<a href="mailto:alexfh@google.com">alexfh@google.com</a>> wrote:<br>

><br>
> <a href="http://reviews.llvm.org/D3541" target="_blank">http://reviews.llvm.org/D3541</a><br>
<div class=""><br>
> +  if (Ctor->isOutOfLine() || Ctor->isImplicit() || Ctor->isDeleted())<br>
>      return;<br>
> +  if (Ctor->isExplicit() || Ctor->isCopyOrMoveConstructor()) {<br>
> +    if (Ctor->isExplicit() && Ctor->isCopyOrMoveConstructor()) {<br>
> +      SourceRange ExplicitTokenRange = FindToken(<br>
> +          *Result.SourceManager, Result.Context->getLangOpts(),<br>
> +          Ctor->getOuterLocStart(), Ctor->getLocEnd(), [](const Token &Tok) {<br>
> +            return Tok.is(tok::raw_identifier) &&<br>
> +                   StringRef(Tok.getRawIdentifierData(), Tok.getLength()) ==<br>
> +                       "explicit";<br>
> +          });<br>
> +      if (ExplicitTokenRange.isValid()) {<br>
> +        DiagnosticBuilder Diag =<br>
> +            diag(ExplicitTokenRange.getBegin(),<br>
> +                 "Copy constructor declared explicit.");<br>
<br>
</div>You mean "copy or move constructor"; and you could use a test for the<br>
move-constructor case.<br></blockquote><div><br></div><div>Thanks for noting, I'll update the message and make the test cases more diverse.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
There are corner cases such as<br>
<br>
    C(const C&&);<br>
    C(const C&, int i = 0);<br>
    template<typename T> C(const T&);<br>
<br>
that would be interesting to test.<br></blockquote><div><br></div><div><div><font face="courier new, monospace">$ cat q.cc</font></div><div><font face="courier new, monospace">class A {</font></div><div><font face="courier new, monospace">public:</font></div>
<div><font face="courier new, monospace">  A(const A&&) {}</font></div><div><font face="courier new, monospace">  A(const A&, int i = 0) {}</font></div><div><font face="courier new, monospace">  template<typename T> A(const T&) {}</font></div>
<div><font face="courier new, monospace">};</font></div><div><font face="courier new, monospace">$ clang-tidy -checks=google -disable-checks='' q.cc  --</font></div><div><font face="courier new, monospace">q.cc:5:24: warning: Single-argument constructors must be explicit [google-explicit-constructor]</font></div>
<div><font face="courier new, monospace">  template<typename T> A(const T&) {}</font></div><div><font face="courier new, monospace">                       ^</font></div><div><font face="courier new, monospace">                       explicit </font></div>
</div><div><br></div><div>Is this what you expected? To me it seems reasonable.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span class=""><font color="#888888"><br>
–Arthur<br>
</font></span></blockquote></div><br><br>
</div></div>