fork(4) download
  1. #include <iostream>
  2.  
  3. class Test {
  4. public:
  5. constexpr Test(int i) : i(i) { }
  6. constexpr int get() { return i; };
  7. private:
  8. int i;
  9. };
  10.  
  11. constexpr int test()
  12. {
  13. return 1;
  14. }
  15.  
  16. int main() {
  17. int x = 0;
  18.  
  19. constexpr Test y = Test(4);
  20.  
  21. switch (x) {
  22. case test(): // this is OK
  23. break;
  24. case y.get(): // not working
  25. break;
  26. }
  27.  
  28. std::cout << "This is the end!" << std::endl;
  29. return 0;
  30. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
This is the end!