Yet another clang/gcc discrepancy regarding ODR usage?

Viewed 721

Why does this code compile with GCC (4.9 and 5+), but not with clang (3.5-3.9)?

void test(const int&) { }
int main() {
  const int x = 42;
  auto f = []{ test(x); };
}

I have some vague idea that the discrepancy has to do with ODR (One Definition Rule) usage, but I don't understand that well enough to figure out what's going on here.

2 Answers
Related