partial-spec-instantiate.cpp 756 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // RUN: %clang_cc1 -fsyntax-only %s
  2. // PR4607
  3. template <class T> struct X {};
  4. template <> struct X<char>
  5. {
  6. static char* g();
  7. };
  8. template <class T> struct X2 {};
  9. template <class U>
  10. struct X2<U*> {
  11. static void f() {
  12. X<U>::g();
  13. }
  14. };
  15. void a(char *a, char *b) {X2<char*>::f();}
  16. namespace WonkyAccess {
  17. template<typename T>
  18. struct X {
  19. int m;
  20. };
  21. template<typename U>
  22. class Y;
  23. template<typename U>
  24. struct Y<U*> : X<U> { };
  25. template<>
  26. struct Y<float*> : X<float> { };
  27. int f(Y<int*> y, Y<float*> y2) {
  28. return y.m + y2.m;
  29. }
  30. }
  31. // <rdar://problem/9169404>
  32. namespace rdar9169404 {
  33. template<typename T, T N> struct X { };
  34. template<bool C> struct X<bool, C> {
  35. typedef int type;
  36. };
  37. X<bool, -1>::type value;
  38. }