tuple_size.fail.cpp 984 B

123456789101112131415161718192021222324252627
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // UNSUPPORTED: c++98, c++03
  10. // <tuple>
  11. // template <class... Types>
  12. // class tuple_size<tuple<Types...>>
  13. // : public integral_constant<size_t, sizeof...(Types)> { };
  14. // Expect failures with a reference type, pointer type, and a non-tuple type.
  15. #include <tuple>
  16. int main()
  17. {
  18. (void)std::tuple_size<std::tuple<> &>::value; // expected-error {{implicit instantiation of undefined template}}
  19. (void)std::tuple_size<int>::value; // expected-error {{implicit instantiation of undefined template}}
  20. (void)std::tuple_size<std::tuple<>*>::value; // expected-error {{implicit instantiation of undefined template}}
  21. }