[PATCH] clang-tidy explicit constructor check: don't warn on copy or move constructors.

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Wed Mar 19 13:45:47 PDT 2014


On Wed, Mar 19, 2014 at 1:33 PM, Alexander Kornienko <alexfh at google.com> wrote:
> We won't warn on any copy or move constructors, including deleted ones. A
> separate check for deleted constructor is not required. See the tests.

It's possible to "=delete" constructors that are not special member
functions. For example,

    struct A {
        A(int) = delete;   // implicit, but deleted
        explicit A(long);
    };
    int main() { A a(0L);  A b(0); }

–Arthur


> On 19 Mar 2014 20:57, "Manuel Klimek" <klimek at google.com> wrote:
>>
>>
>>
>> ================
>> Comment at: clang-tidy/google/GoogleTidyModule.cpp:37
>> @@ -36,3 +36,3 @@
>>    if (Ctor->isOutOfLine() || Ctor->isExplicit() || Ctor->isImplicit() ||
>> -      Ctor->isDeleted())
>> +      Ctor->isCopyOrMoveConstructor())
>>      return;
>> ----------------
>> And why do we want to warn on deleted constructors?
>>
>>
>> http://llvm-reviews.chandlerc.com/D3122
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list