[LLVMbugs] [Bug 20173] New: Move constructor SFINAE from parameter list to template argument list to work with inheriting constructors.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jun 30 22:37:41 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20173
Bug ID: 20173
Summary: Move constructor SFINAE from parameter list to
template argument list to work with inheriting
constructors.
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: eric at efcs.ca
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
Inheriting constructors and SFINAE in constructor parameter lists do not play
nicely in c++11 due to 12.9.1.
For example the following code will not compile although it likely should.
#include <type_traits>
struct A {
A(int) {}
template <class T>
A(T, typename std::enable_if<!std::is_same<T, int>::value>::type* = 0) {}
};
struct B : public A { using A::A; };
int main() { B b(0); }
I think an effort should be made to convert constructors with SFINAE into forms
that allow the constructors to be inherited.
Some conversions may require the use of default NTTP in function templates
which is a C++11 extension. It may not be worth it change these constructors.
This is the initial list of classes that have SFINAE constructor parameters and
should be considered for conversion:
- chrono::duration
- chrono::time_point
- forward_list
- function
- list
- default_delete
- queue
- linear_congruential_engine
- mersenne_twister_engine
- subtract_with_carry_engine
- discard_block_engine
- independent_bits_engine
- shuffle_order_engine
- stack
- error_condition
- pair
- vector
Open Questions:
- Is there a way to tell if the compiler supports default NTTPs for function
templates?
- Should classes that require C++03 support be converted if it means having
two sets of constructors?
- Are there any problems with moving SFINAE to the template argument list?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140701/1d4dc3cc/attachment.html>
More information about the llvm-bugs
mailing list