summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-function-1.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-15 18:53:42 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-15 18:53:42 +0000
commit9d73cabf22b970ec47eaae9b01ca55430f426618 (patch)
tree8e5c9800342159075873a353429e0c63672a0f62 /clang/test/SemaTemplate/instantiate-function-1.cpp
parenta3d4d7b4fa31f38ffb9f7709de3ebcdbd54ad88b (diff)
downloadbcm5719-llvm-9d73cabf22b970ec47eaae9b01ca55430f426618.tar.gz
bcm5719-llvm-9d73cabf22b970ec47eaae9b01ca55430f426618.zip
Template instantiation for "if" statements. Also:
- Skip semantic analysis of the "if" condition if it is type-dependent. - Added the location of the "else" keyword into IfStmt, so that we can provide it for type-checking after template instantiation. llvm-svn: 71875
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-function-1.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-function-1.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-function-1.cpp b/clang/test/SemaTemplate/instantiate-function-1.cpp
index 482b466e845..5ded6140a63 100644
--- a/clang/test/SemaTemplate/instantiate-function-1.cpp
+++ b/clang/test/SemaTemplate/instantiate-function-1.cpp
@@ -58,3 +58,20 @@ template<typename T> struct X5 {
void test_X5(X5<Incomplete> x5); // okay!
template struct X5<Incomplete>; // expected-note{{instantiation}}
+
+template<typename T, typename U, typename V> struct X6 {
+ U f(T t, U u, V v) {
+ // IfStmt
+ if (t > 0)
+ return u;
+ else
+ return v; // expected-error{{incompatible type}}
+ }
+};
+
+struct ConvertibleToInt {
+ operator int() const;
+};
+
+template struct X6<ConvertibleToInt, float, char>;
+template struct X6<bool, int, int*>; // expected-note{{instantiation}}
OpenPOWER on IntegriCloud