Dependent name lookup in function template: clang rejects, gcc accepts

Viewed 332

Consider the following fragment:

struct X { };

namespace foo {
    template <class T>
    void bar() { T{} < T{}; }

    void operator<(const X&, const X&) {}
}

int main() {
    foo::bar<X>();
}

clang rejects this code, gcc accepts it. Is this a gcc bug or is this a clang bug?

2 Answers
Related