Problem with overloading a member function of a template

The standard N4296::13.1/2.2 [over.load]says:

Similarly, declarations of templates of member functions with the same name, the same list of parameter parameters and the same parameter parameters of the template cannot be overloaded if any of them is a function of the static member declaration template.

So, I thought the following program would be poorly formed:

#include <iostream>

struct A
{
    template <typename T>
    static void foo(){ }

    template <typename T>
    static int foo(){ return 0; }
};

int main(){ }

Demo

Unlike the program

#include <iostream>

struct A
{
    static void foo(){ }

    static int foo(){ return 0; }
};

int main(){ }

poorly formed

Demo

Is the first example a mistake?

+4
source share
1 answer

Currently CWG # 1252 Theme :

-, (cf enable_if).

, , , , - SFINAE ; , , .

0

Source: https://habr.com/ru/post/1569512/


All Articles