summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-init.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-03 03:35:07 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-03 03:35:07 +0000
commitf15748a28c8443eef2924ef83689c358c661e9c5 (patch)
tree6f025ec9ea1015e1263b38d41e3a220aff5cbaf5 /test/SemaTemplate/instantiate-init.cpp
parent8735b294a257a07ca158c28094d7324f0adf889a (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132530 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-init.cpp')
-rw-r--r--test/SemaTemplate/instantiate-init.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-init.cpp b/test/SemaTemplate/instantiate-init.cpp
index d5711ddf5a..ce2c1633b1 100644
--- a/test/SemaTemplate/instantiate-init.cpp
+++ b/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);
+ }
+}