derived.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
  3. template<typename T> class vector2 {};
  4. template<typename T> class vector : vector2<T> {};
  5. template<typename T> void Foo2(vector2<const T*> V) {} // expected-note{{candidate template ignored: can't deduce a type for 'T' that would make 'const T' equal 'int'}}
  6. template<typename T> void Foo(vector<const T*> V) {} // expected-note {{candidate template ignored: can't deduce a type for 'T' that would make 'const T' equal 'int'}}
  7. void test() {
  8. Foo2(vector2<int*>()); // expected-error{{no matching function for call to 'Foo2'}}
  9. Foo(vector<int*>()); // expected-error{{no matching function for call to 'Foo'}}
  10. }
  11. namespace rdar13267210 {
  12. template < typename T > class A {
  13. BaseTy; // expected-error{{C++ requires a type specifier for all declarations}}
  14. };
  15. template < typename T, int N > class C: A < T > {};
  16. class B {
  17. C<long, 16> ExternalDefinitions;
  18. C<long, 64> &Record;
  19. void AddSourceLocation(A<long> &R); // expected-note{{passing argument to parameter 'R' here}}
  20. void AddTemplateKWAndArgsInfo() {
  21. AddSourceLocation(Record); // expected-error{{non-const lvalue reference to type}}
  22. }
  23. };
  24. }
  25. namespace PR16292 {
  26. class IncompleteClass; // expected-note{{forward declaration}}
  27. class BaseClass {
  28. IncompleteClass Foo; // expected-error{{field has incomplete type}}
  29. };
  30. template<class T> class DerivedClass : public BaseClass {};
  31. void* p = new DerivedClass<void>;
  32. }
  33. namespace rdar14183893 {
  34. class Typ { // expected-note {{not complete}}
  35. Typ x; // expected-error {{incomplete type}}
  36. };
  37. template <unsigned C> class B : Typ {};
  38. typedef B<0> TFP;
  39. class A {
  40. TFP m_p;
  41. void Enable() { 0, A(); } // expected-warning {{unused}}
  42. };
  43. }