[PATCH] [libcxx] Fix copy/move issues caused by __tuple_leaf's converting constructor.

Eric Fiselier eric at efcs.ca
Wed Jul 9 20:57:42 PDT 2014

Hi mclow.lists,

This patch contains two fixes issues arising around __tuple_leafs converting constructor.

1. The first problem is that __tuple_leaf<T> uses is_constructible<T, U> to enable/disable it's converting constructor `__tuple_leaf(U &&)`. Evaluating is_constructible under certain conditions can cause a hard compile error. Currently is_constructible<T, __tuple_leaf> is evaluated whenever __tuple_leaf is copied or moved. This patch prevents that from happening by only evaluating is_constructible when U != __tuple_leaf.

2. The second problem is that __tuple_leaf's specialization for empty types does have an implicitly generated move constructor because it declares a deleted assignment operator.
This causes the converting to be constructor during moves. The problem is solved by disabling the constructor when U == __tuple_leaf and giving __tuple_leaf a defaulted move constructor (so the defaulted copy constructor is not called). 

There is also a small fix to two tests that needed extra brackets around an assert macro.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4451.11240.patch
Type: text/x-patch
Size: 7111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140710/370693fc/attachment.bin>

More information about the cfe-commits mailing list