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