mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
Implement LWG 2711. Constrain path members.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279945 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -80,6 +80,37 @@ void RunTestCase(MultiStringType const& MS) {
|
||||
}
|
||||
}
|
||||
|
||||
void test_sfinae() {
|
||||
using namespace fs;
|
||||
{
|
||||
using It = const char* const;
|
||||
static_assert(std::is_constructible<path, It>::value, "");
|
||||
}
|
||||
{
|
||||
using It = input_iterator<const char*>;
|
||||
static_assert(std::is_constructible<path, It>::value, "");
|
||||
}
|
||||
{
|
||||
struct Traits {
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
using value_type = const char;
|
||||
using pointer = const char*;
|
||||
using reference = const char&;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
};
|
||||
using It = input_iterator<const char*, Traits>;
|
||||
static_assert(std::is_constructible<path, It>::value, "");
|
||||
}
|
||||
{
|
||||
using It = output_iterator<const char*>;
|
||||
static_assert(!std::is_constructible<path, It>::value, "");
|
||||
|
||||
}
|
||||
{
|
||||
static_assert(!std::is_constructible<path, int*>::value, "");
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
for (auto const& MS : PathList) {
|
||||
RunTestCase<char>(MS);
|
||||
@@ -87,4 +118,5 @@ int main() {
|
||||
RunTestCase<char16_t>(MS);
|
||||
RunTestCase<char32_t>(MS);
|
||||
}
|
||||
test_sfinae();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user