Stupid linker?

The most popular error in C and C++ is the followong: arrays and pointers are equals.


// a.cpp

int t[] = { 1, 2, 3, 4, 5};

int main()
{
    cout << t[2] << endl;   // ok
    
    int *p = t;
    cout << p[2] << endl;   // ok
    
    g(p);
    g(t);
    
    return 0;
}

// b.cpp

extern int *t;

int g( int *par)
{
    cout << par[2] << endl;     // ok
    cout <<   t[2] << endl;     // runtime error
}