Guest User

Untitled

a guest
Jun 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. template<typename T, std::size_t N>
  2. constexpr std::size_t Length(const T(&)[N]) {
  3. return N;
  4. }
  5.  
  6. struct Foo
  7. {
  8. unsigned int temp1[3];
  9. void Bar()
  10. {
  11. unsigned int temp2[Length(temp1)]; // Error here
  12. }
  13. };
  14.  
  15. error C2131: expression did not evaluate to a constant
  16.  
  17. note: failure was caused by a read of a variable outside its lifetime
  18.  
  19. note: see usage of 'this'
Add Comment
Please, Sign In to add comment