[cfe-commits] r85244 - /cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp

Douglas Gregor dgregor at apple.com
Tue Oct 27 08:36:38 PDT 2009


Author: dgregor
Date: Tue Oct 27 10:36:37 2009
New Revision: 85244

URL: http://llvm.org/viewvc/llvm-project?rev=85244&view=rev
Log:
Test for interaction between explicit instantiations and specializations

Added:
    cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp   (with props)

Added: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp?rev=85244&view=auto

==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp Tue Oct 27 10:36:37 2009
@@ -0,0 +1,36 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<typename T>
+struct X0 {
+  struct MemberClass {
+    T member; // expected-error{{with function type}}
+  };
+  
+  T* f0(T* ptr) { 
+    return ptr + 1; // expected-error{{pointer to function}}
+  } 
+  
+  static T* static_member;
+};
+
+template<typename T>
+T* X0<T>::static_member = ((T*)0) + 1; // expected-error{{pointer to function}}
+
+template class X0<int>; // okay
+
+template class X0<int(int)>; // expected-note 3{{requested here}}
+
+// Specialize everything, so that the explicit instantiation does not trigger
+// any diagnostics.
+template<>
+struct X0<int(long)>::MemberClass { };
+
+typedef int int_long_func(long);
+template<>
+int_long_func *X0<int_long_func>::f0(int_long_func *) { return 0; }
+
+template<>
+int_long_func *X0<int(long)>::static_member;
+
+template class X0<int(long)>;
+

Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp

------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p7.cpp

------------------------------------------------------------------------------
    svn:mime-type = text/plain





More information about the cfe-commits mailing list