Explicit instantiation of templated constructor for template class

前端 未结 1 1360
半阙折子戏
半阙折子戏 2020-12-18 23:20

I am uncertain if it is a bug in Clang 3.2 or a violation of C++03, but it appears that explicit instantiation of templated constructors for template classes fails, but expl

1条回答
  •  天涯浪人
    2020-12-18 23:31

    It looks like you've found a GCC bug. These both name the implicitly-declared copy constructor:

    template Foo::Foo( const Foo& foo );
    template Foo::Foo( const Foo& foo );
    

    Per [temp.explicit]p4,

    If the declaration of the explicit instantiation names an implicitly-declared special member function (Clause 12), the program is ill-formed.

    Therefore Clang is correct to reject this code.

    0 讨论(0)
提交回复
热议问题