Showing posts with label cpp_trap. Show all posts
Showing posts with label cpp_trap. Show all posts

Jun 21, 2018

[C++] data member with same symbol name as user declared constructor

http://eel.is/c++draft/class.mem#20

In addition, if class T has a user-declared constructor, every non-static data member of class T shall have a name different from T.


i.e
struct foo { 
  ~foo(); 
  int foo;  // OK
};

struct bar { 
  bar(); 
  int bar;  // Error
};