1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3// If T is the name of a class, then each of the following shall have 4// a name different from T: 5 6// - every static data member of class T; 7struct X0 { 8 static int X0; // expected-error{{member 'X0' has the same name as its class}} 9}; 10 11// - every member function of class T 12// (Cannot be tested) 13 14// - every member of class T that is itself a type; 15struct X1 { // expected-note{{previous use is here}} 16 enum X1 { }; // expected-error{{use of 'X1' with tag type that does not match previous declaration}} 17}; 18 19struct X2 { 20 typedef int X2; // expected-error{{member 'X2' has the same name as its class}} 21}; 22 23// - every enumerator of every member of class T that is an enumerated type; and 24struct X3 { 25 enum E { 26 X3 // expected-error{{member 'X3' has the same name as its class}} 27 }; 28}; 29 30// - every member of every anonymous union that is a member of class T. 31struct X4 { 32 union { 33 int X; 34 union { 35 float Y; 36 unsigned X4; // expected-error{{member 'X4' has the same name as its class}} 37 }; 38 }; 39}; 40 41