fork download
  1. #include <iostream>
  2.  
  3. constexpr int g() { return 30; }
  4.  
  5. constexpr int f()
  6. {
  7. // Can we always omit const?
  8. /* const */ int x = g();
  9. x+=2;
  10. /* const */ int y = 10;
  11.  
  12. return x + y;
  13. }
  14.  
  15. int main() {
  16.  
  17. std::cout << f() << "\n";
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
42