Visual C ++ 14 CTP3: C ++ 11 inherit constructor error?

The following code fragment builds perfectly in accordance with Clang 3.4 / 3.5 (Xcode 5/6), but throws an error in Visual C ++ 14 CTP3:

1> ------ Build start: Project: InheritingConstructor, Configuration:
Win32 debugging ------ 1> inheritingconstructor.cpp (60): error C2661:
'D :: D': no ​​overloaded function accepts 2 argument
========== Build: 0 succeeded, 1 failed, 0 updated, 0 skipped ==========

The code strengthens the compiler a bit by trying to inherit the template constructor from the base class, is it possible that when Visual C ++ fails again in the competition? Or am I getting into some kind of gray area, thus undefined behavior in the standard?

#include "stdafx.h" // comment out this line for Xcode build
#include <iostream>
#include <type_traits>

template <typename X>
struct B
{
    int i;
    B(int i_) : i(i_) {}

    template < typename T, typename = typename std::enable_if<
        std::is_same<T, X>::value >::type >
    B(const T*, const T*) : i(0) {}
};

struct D : B<D>
{
    using B<D>::B; // inherit constructors from B
};

int main(int argc, const char * argv[]) {
    // insert code here...
    D d((D*)nullptr, (D*)nullptr);
    std::cout << "Hello, World!\n";
    return 0;
}
+4
1

.

V++ 2013 LINK.

, LINK , V++ 2014 CTP 1.

, , LINK.

: V++ 2014, .

+4

All Articles