diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-06-03 03:35:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-06-03 03:35:07 +0000 |
commit | 57d4f972b77b57e4f05b4c704b6b14af0db05d42 (patch) | |
tree | f31d737313e16ea445ef42dec507a2d68e812c3d /clang/test/SemaTemplate/instantiate-init.cpp | |
parent | 2f157c9ae2a2a4f2f7f0c6bd36359fcd57b91df7 (diff) | |
download | bcm5719-llvm-57d4f972b77b57e4f05b4c704b6b14af0db05d42.tar.gz bcm5719-llvm-57d4f972b77b57e4f05b4c704b6b14af0db05d42.zip |
When performing template argument deduction given a function argument
of incomplete array type, attempt to complete the array type. This was
made much easier by Chandler's addition of RequireCompleteExprType(),
which I've tweaked (slightly) to improve the consistency of the
DeclRefExpr. Fixes PR7985.
llvm-svn: 132530
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-init.cpp')
-rw-r--r-- | clang/test/SemaTemplate/instantiate-init.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-init.cpp b/clang/test/SemaTemplate/instantiate-init.cpp index d5711ddf5a2..ce2c1633b14 100644 --- a/clang/test/SemaTemplate/instantiate-init.cpp +++ b/clang/test/SemaTemplate/instantiate-init.cpp @@ -73,3 +73,26 @@ namespace PR10001 { int x = S<int>::f(); } + +namespace PR7985 { + template<int N> struct integral_c { }; + + template <typename T, int N> + integral_c<N> array_lengthof(T (&x)[N]) { return integral_c<N>(); } + + struct Data { + int x; + }; + + template<typename T> + struct Description { + static const Data data[]; + }; + + template<typename T> + const Data Description<T>::data[] = {{ 0 }}; + + void test() { + integral_c<1> ic1 = array_lengthof(Description<int>::data); + } +} |