fork download
  1. #include <cassert>
  2.  
  3.  
  4. int sum(int x, int y) { return x + y; }
  5.  
  6. template<int X, int Y>
  7. struct msum {
  8. static constexpr auto value = X + Y;
  9. };
  10.  
  11.  
  12. volatile int x = 3;
  13. volatile int y = 5;
  14.  
  15. int main() {
  16. assert(sum(x, y) == 8);
  17. static_assert(msum<3, 5>::value == 8);
  18. }
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
Standard output is empty