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