diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-15 18:53:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-15 18:53:42 +0000 |
commit | d06f6ca61062f85926eb9d409eb3d4f8afcf93c7 (patch) | |
tree | 9caf4b47278290f24aff828efc481b32c9a3aebb /test/SemaTemplate/instantiate-function-1.cpp | |
parent | 2e24661a0f880b88a6ececb9c32830c403067329 (diff) | |
download | clang-d06f6ca61062f85926eb9d409eb3d4f8afcf93c7.tar.gz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-function-1.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-function-1.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp index 482b466e84..5ded6140a6 100644 --- a/test/SemaTemplate/instantiate-function-1.cpp +++ b/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}} |