In class nested static const member variable initialization Clang vs GCC which compiler is right?

Viewed 249

Consider the following piece of code:

#include <iostream>

struct Foo {
  static int const i = i + 1;
};

int main() {
  std::cout << Foo::i << std::endl;
}

Clang version 3.7 compiles this and outputs 1.

Live Demo

While GCC version 5.3 emits an error:

error: 'i' was not declared in this scope

Live Demo

Q:

Which one of the two compilers conforms to the C++ standard?

2 Answers
Related