Explicit specialization of C++ struct member template functions - is this a Visual Studio problem?

后端 未结 1 1113
梦毁少年i
梦毁少年i 2021-01-13 19:54

I have a problem with template specialization which boils down to the following snippet:

#include 

struct Class
{
    template 

        
1条回答
  •  再見小時候
    2021-01-13 20:05

    Well, I'd say it is most likely legal c++ code as I compile and run it fine with:

    g++ -ansi -gstabs+ -Wall -o fun fun.cpp
    g++ -std=c++98 -gstabs+ -Wall -o fun fun.cpp
    g++ -std=c++0x -gstabs+ -Wall -o fun fun.cpp
    

    I'm suspecting it's the same bug mentioned here: http://msdn.microsoft.com/en-us/library/cx7k7hcf(v=vs.80).aspx

    Particularly:

    The explicit specialization of a member function outside the class is not valid if the function has already been explicitly specialized via a template class specialization. (C2910).

    from http://msdn.microsoft.com/en-us/library/h62s5036(v=vs.80).aspx

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