The following code is provided at cppreference.com as an example of an explanation of dependent name resolution:
#include <iostream>
void g(double) { std::cout << "g(double)\n"; }
template<class T>
struct S {
void f() const {
g(1);
}
};
void g(int) { std::cout << "g(int)\n"; }
int main()
{
g(1);
S<int> s;
s.f();
}
The current version of Visual C ++ (19.0.23918.0) displays the following result:
g(int)
g(int)
Is this allowed by the standard, or is it a bug in MSVC?
source
share