1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 struct InClassInitializerOnly { 3 static const int i = 0; 4 }; 5 int const InClassInitializerOnly::i; 6 7 struct OutOfClassInitializerOnly { 8 static const int i; 9 }; 10 int const OutOfClassInitializerOnly::i = 0; 11 12 struct InClassInitializerAndOutOfClassCopyInitializer { 13 static const int i = 0; // expected-note{{previous initialization is here}} 14 }; 15 int const InClassInitializerAndOutOfClassCopyInitializer::i = 0; // expected-error{{static data member 'i' already has an initializer}} 16 17 struct InClassInitializerAndOutOfClassDirectInitializer { 18 static const int i = 0; // expected-note{{previous initialization is here}} 19 }; 20 int const InClassInitializerAndOutOfClassDirectInitializer::i(0); // expected-error{{static data member 'i' already has an initializer}} 21 22 main()23int main() { } 24 25