[llvm] r223238 - Silencing several "multiple copy constructors" warnings from MSVC; NFC.
Aaron Ballman
aaron at aaronballman.com
Wed Dec 3 10:41:57 PST 2014
On Wed, Dec 3, 2014 at 1:36 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:
> I don't understand this. AFAICT, that's the *only* copy constructor.
It's not.
EmplaceableArg(EmplaceableArg &X)
: State(X.State == EAS_Arg ? EAS_LValue : EAS_Failure) {}
That's the copy constructor.
> If that function isn't deleted, compilers will generate one, won't they?
No, because the non-const version exists and is considered a copy constructor.
~Aaron
>
> Here's the full text, after your change:
>
>> template <int I> struct EmplaceableArg {
>> EmplaceableArgState State;
>> EmplaceableArg() : State(EAS_Defaulted) {}
>> EmplaceableArg(EmplaceableArg &&X)
>> : State(X.State == EAS_Arg ? EAS_RValue : EAS_Failure) {}
>> EmplaceableArg(EmplaceableArg &X)
>> : State(X.State == EAS_Arg ? EAS_LValue : EAS_Failure) {}
>>
>> explicit EmplaceableArg(bool) : State(EAS_Arg) {}
>>
>> private:
>> EmplaceableArg &operator=(EmplaceableArg &&) LLVM_DELETED_FUNCTION;
>> EmplaceableArg &operator=(const EmplaceableArg &) LLVM_DELETED_FUNCTION;
>> };
>
> I don't see any copy constructors anymore.
>
> Two questions:
>
> 1. Can someone explain what's going on with MSVC here?
>
> 2. Is there a macro I can use to add back the deleted copy constructor
> when we're not using MSVC?
>
> OTOH, this warning doesn't look useful. Should we be disabling it in the
> MSVC build?
>
> (Or maybe my premise is wrong? Does the standard not generate a normal
> copy constructor here?)
>
>> On 2014-Dec-03, at 06:44, Aaron Ballman <aaron at aaronballman.com> wrote:
>>
>> Author: aaronballman
>> Date: Wed Dec 3 08:44:16 2014
>> New Revision: 223238
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=223238&view=rev
>> Log:
>> Silencing several "multiple copy constructors" warnings from MSVC; NFC.
>>
>> Modified:
>> llvm/trunk/unittests/ADT/SmallVectorTest.cpp
>>
>> Modified: llvm/trunk/unittests/ADT/SmallVectorTest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallVectorTest.cpp?rev=223238&r1=223237&r2=223238&view=diff
>> ==============================================================================
>> --- llvm/trunk/unittests/ADT/SmallVectorTest.cpp (original)
>> +++ llvm/trunk/unittests/ADT/SmallVectorTest.cpp Wed Dec 3 08:44:16 2014
>> @@ -717,7 +717,6 @@ template <int I> struct EmplaceableArg {
>> explicit EmplaceableArg(bool) : State(EAS_Arg) {}
>>
>> private:
>> - EmplaceableArg(const EmplaceableArg &X) LLVM_DELETED_FUNCTION;
>> EmplaceableArg &operator=(EmplaceableArg &&) LLVM_DELETED_FUNCTION;
>> EmplaceableArg &operator=(const EmplaceableArg &) LLVM_DELETED_FUNCTION;
>> };
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list