summaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-15 14:05:49 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-15 14:05:49 +0000
commite2d3a3de71b2fa35614cb732a6da95a41fa38ad9 (patch)
treef59f0a8f3395319bf7cf5e2e065bc4e71ac8cc76 /test/CXX
parentbf7643e7966cd9acd797a84870018034112e49d3 (diff)
downloadclang-e2d3a3de71b2fa35614cb732a6da95a41fa38ad9.tar.gz
Diagnose explicit instantiations of function templates and member
functions/static data members of class template specializations that do not have definitions. This is the latter part of [temp.explicit]p4; the former part still needs more testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p2.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p4.cpp16
3 files changed, 18 insertions, 2 deletions
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
index becdd6b606..d7731f1763 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
@@ -2,7 +2,7 @@
template<typename T>
struct X {
- void f();
+ void f() {}
};
template inline void X<int>::f(); // expected-error{{'inline'}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
index aee0e5d19d..f3d2c955cb 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
@@ -35,7 +35,7 @@ namespace N {
};
template<typename T>
- void f1(T); // expected-note{{explicit instantiation refers here}}
+ void f1(T) {}; // expected-note{{explicit instantiation refers here}}
}
using namespace N;
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p4.cpp b/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
new file mode 100644
index 0000000000..c45df562e4
--- /dev/null
+++ b/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
@@ -0,0 +1,16 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<typename T> void f0(T); // expected-note{{here}}
+template void f0(int); // expected-error{{explicit instantiation of undefined function template}}
+
+template<typename T>
+struct X0 {
+ void f1(); // expected-note{{here}}
+
+ static T value; // expected-note{{here}}
+};
+
+template void X0<int>::f1(); // expected-error{{explicit instantiation of undefined member function}}
+
+template int X0<int>::value; // expected-error{{explicit instantiation of undefined static data member}}
+