vendredi 2 février 2018

Are collisions between expressions and namespaces expected when invoking ADL?

Given the following example, I would expect the parser to recognize std as a function:

#include <algorithm>

namespace test
{
    void std(int i);
}

int main()
{
    std(0);
    return 0;
}

However, with GCC 4.8.4 this results in an error - "error: unexpected namespace name 'std': expected expression."

With clang 5.0, I get "error: unexpected namespace name 'std': expected expression"

Is this expected? I can't imagine that the parser doesn't have enough context here to distinguish between expression and namespace?

Aucun commentaire:

Enregistrer un commentaire