[LLVMdev] Explicit constructors with more than one argument

Chandler Carruth chandlerc at google.com
Sat Mar 14 22:51:24 PDT 2015

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};".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150314/4ccf0474/attachment.html>

More information about the llvm-dev mailing list