Clang Project

clang_source_code/test/CXX/class/class.mem/p14.cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// In addition, if class T has a user-declared constructor (12.1),
4// every non-static data member of class T shall have a name different
5// from T.
6
7struct X0 {
8  int X0; // okay
9};
10
11struct X1 {
12  int X1; // expected-error{{member 'X1' has the same name as its class}}
13  X1();
14};
15
16struct X2 {
17  X2();
18  float X2; // expected-error{{member 'X2' has the same name as its class}}
19};
20