cxx_generalized_initializers.cpp 551 B

12345678910111213141516171819202122232425262728293031
  1. #if defined(_MSC_VER) && _MSC_VER == 1800 && _MSC_FULL_VER < 180030723
  2. #error "VS 2013 safely supports this only with Update 3 or greater"
  3. #endif
  4. // Dummy implementation. Test only the compiler feature.
  5. namespace std {
  6. typedef decltype(sizeof(int)) size_t;
  7. template <class _E>
  8. class initializer_list
  9. {
  10. const _E* __begin_;
  11. size_t __size_;
  12. public:
  13. template <typename T1, typename T2>
  14. initializer_list(T1, T2)
  15. {
  16. }
  17. };
  18. }
  19. template <typename T>
  20. struct A
  21. {
  22. A(std::initializer_list<T>) {}
  23. };
  24. void someFunc()
  25. {
  26. A<int> as = { 1, 2, 3, 4 };
  27. }