$cat test.h
#pragma once
#include <utility>
class Test
{
public:
    typedef std::pair<unsigned, void*> MyPair;
    MyPair foo();
    static const unsigned Invalid = (unsigned)-1;
};
$ cat test.cpp
#include "test.h"
#include <cstdio>
Test::MyPair Test::foo()
{
    // that's worked in c++11
    // const unsigned var = Invalid;
    // return std::make_pair(var, nullptr);
    // that's worked in c++11 too
    // return std::make_pair((unsigned)Invalid, nullptr);
    return std::make_pair(Invalid, nullptr);
}
int main(int argc, const char* argv[])
{
    Test test;
    Test::MyPair pair = test.foo();
    printf("first: %u, second: %p\n", pair.first, pair.second);
    return 0;
}
$ g++ test.cpp
$ ./a.out
first: 4294967295, second: 0x0
$ g++ -std=c++11 test.cpp
Undefined symbols for architecture x86_64:
  "Test::Invalid", referenced from:
      Test::foo() in t-f9f766.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ткните носом в стандарт, где поясняется почему std::forward() не должен видеть статический мембер?



