Guest User

Untitled

a guest
Oct 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. void bar(){}
  2.  
  3. constexpr int foo(int a)
  4. {
  5. if (a <=0 )
  6. bar();
  7.  
  8. return 1;
  9. }
  10.  
  11. int main()
  12. {
  13. int a1[foo(1)]; //no compile error
  14. }
  15.  
  16. int a2[foo(-1)]; //will give a compile error, which is expected,
  17. //since non-constexpr function is not allowd in constexpr context
Add Comment
Please, Sign In to add comment