Douglas Gregor | f0f8369 | 2010-08-24 05:27:49 +0000 | [diff] [blame^] | 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 definition is here}} |
| 14 | }; |
| 15 | int const InClassInitializerAndOutOfClassCopyInitializer::i = 0; // expected-error{{redefinition of 'i'}} |
| 16 | |
| 17 | struct InClassInitializerAndOutOfClassDirectInitializer { |
| 18 | static const int i = 0; // expected-note{{previous definition is here}} |
| 19 | }; |
| 20 | int const InClassInitializerAndOutOfClassDirectInitializer::i(0); // expected-error{{redefinition of 'i'}} |
| 21 | |
| 22 | |
| 23 | |
| 24 | int main() { } |
| 25 | |