p14.cpp 595 B

1234567891011121314151617181920
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // In addition, if class T has a user-declared constructor (12.1),
  3. // every non-static data member of class T shall have a name different
  4. // from T.
  5. struct X0 {
  6. int X0; // okay
  7. };
  8. struct X1 {
  9. int X1; // expected-note{{hidden by a non-type declaration of 'X1' here}}
  10. X1(); // expected-error{{must use 'struct' tag to refer to type 'X1' in this scope}} \
  11. // expected-error{{expected member name or ';' after declaration specifiers}}
  12. };
  13. struct X2 {
  14. X2();
  15. float X2; // expected-error{{member 'X2' has the same name as its class}}
  16. };