[LLVMdev] Explicit constructors with more than one argument

Gabriel Dos Reis gdr at integrable-solutions.net
Sun Mar 15 12:37:08 PDT 2015


On Sun, Mar 15, 2015 at 9:58 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Sat, Mar 14, 2015 at 10:51 PM, Chandler Carruth <chandlerc at google.com>
> wrote:
>
>>
>> On Sat, Mar 14, 2015 at 10:26 PM, Gabriel Dos Reis <
>> gdr at integrable-solutions.net> wrote:
>>
>>> Hi,
>>>
>>> Some LLVM classes (e.g. ReturnInst) have explicit constructors with at
>>> least two parameters (with no default arguments).   Why is that?  E.g. what
>>> are they trying to prevent?
>>>
>>> -- Gaby
>>>
>>
>> FWIW, I suspect that it is mostly an accident (IE, one of the arguments
>> was added without removing the explicit or a default was removed, etc.)
>>
>> However, there are good reasons for this in C++11 -- making constructors
>> explicit prevents them from being called in return statements like "return
>> {a, b};".
>>
>
> Yeah, my current take on it is: yeah, some 'explicit' on multi-arg ctors
> is probably accidental, but it's not pointless so removing it isn't
> entirely trivial. But adding explicit to every no-arg ctor you don't want
> to call with braced init seems... painfully verbose, so I've not taken a
> strong stance that we should do that either.
>
> And I /think/ MSVC still doesn't support braced init, so it's all a bit of
> an abstract debate for the LLVM codebase for now anyway.
>

Right.
Based on the VS2015 CTP6 release, I suspect we can assume that VS2015 will
support uniform initialization.

-- Gaby



>
>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150315/353fd6bc/attachment.html>


More information about the llvm-dev mailing list