[cfe-commits] r85243 - in /cfe/trunk/test/CXX/temp/temp.spec/temp.explicit: p12.cpp p5.cpp p6.cpp
Douglas Gregor
dgregor at apple.com
Tue Oct 27 08:00:13 PDT 2009
Author: dgregor
Date: Tue Oct 27 10:00:12 2009
New Revision: 85243
URL: http://llvm.org/viewvc/llvm-project?rev=85243&view=rev
Log:
Test various aspects of explicit instantiation that were already implemented.
Added:
cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp (with props)
cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp (with props)
cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp (with props)
Added: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp?rev=85243&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp Tue Oct 27 10:00:12 2009
@@ -0,0 +1,6 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+char* p = 0;
+template<class T> T g(T x = &p) { return x; }
+template int g<int>(int); // OK even though &p isnât an int.
+
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp?rev=85243&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp Tue Oct 27 10:00:12 2009
@@ -0,0 +1,18 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace N {
+ template<class T> class Y { // expected-note{{explicit instantiation refers here}}
+ void mf() { }
+ };
+}
+
+// FIXME: poor diagnostic
+template class Z<int>; // expected-error{{unqualified-id}}
+
+// FIXME: This example from the standard is wrong; note posted to CWG reflector
+// on 10/27/2009
+using N::Y;
+template class Y<int>; // expected-error{{must occur in}}
+
+template class N::Y<char*>;
+template void N::Y<double>::mf();
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp?rev=85243&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp Tue Oct 27 10:00:12 2009
@@ -0,0 +1,14 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<class T> class Array { /* ... */ };
+template<class T> void sort(Array<T>& v) { }
+
+// instantiate sort(Array<int>&) - template-argument deduced
+template void sort<>(Array<int>&);
+
+template void sort(Array<long>&);
+
+template<typename T, typename U> void f0(T, U*) { }
+
+template void f0<int>(int, float*);
+template void f0<>(double, float*);
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list