[PATCH] D27679: Simplify format member detection in FormatVariadic

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 10:13:59 PST 2016


What if constructor takes a const int &

On Wed, Dec 14, 2016 at 10:08 AM Pavel Labath <labath at google.com> wrote:

> On 14 December 2016 at 18:02, Zachary Turner <zturner at google.com> wrote:
> > Can you give me an example of a trivial adapter with "broken" code and
> then
> > how to fix it?  Doesn't this work?
> >
> > class FooAdapter : public FormatAdapter<int> {
> > public:
> >   explicit FooAdapter(int n) : FormatAdapter<int>(n) {}
> > };
>
> That will not work because the base constructor accepts a rvalue
> reference, which will not bind to "n". To make it compile you need to
> do a std::move(n). There's nothing truly broken there, it's just
> moderately annoying.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161214/8d48113b/attachment.html>


More information about the llvm-commits mailing list