cxx_generalized_initializers.cpp 569 B

12345678910111213141516171819202122232425262728
  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. template <typename T>
  18. struct A
  19. {
  20. A(std::initializer_list<T>) {}
  21. };
  22. void someFunc()
  23. {
  24. A<int> as = { 1, 2, 3, 4 };
  25. }