Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class C {
  2. enum { X = 42; }
  3. };
  4.  
  5. class C {
  6. static const auto X = 42;
  7. };
  8.  
  9. static const auto X = 1ul;
  10.  
  11. enum { X = 1 };
  12. enum : unsigned long { Y = 1 };
  13.  
  14. struct C {
  15. static const auto X = 1;
  16. };
  17.  
  18. int f(const int& arg) {
  19. return arg;
  20. }
  21.  
  22. int main() {
  23. return f(C::X);
  24. }
  25.  
  26. main.cpp:(.text+0x15): undefined reference to `C::X'
  27.  
  28. struct C {
  29. static const int X;
  30. };
  31.  
  32. const int C::X = 1;
  33.  
  34. f(static_cast<int>(C::X)); // явный каст
  35. f(+C::X); // унарный плюс
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement