summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-02-14 02:07:53 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-02-14 02:07:53 +0000
commitf1f20e6802b286e44631c814181e27cf8a5bc947 (patch)
treefeab1a4664d4b580da909a737e8c8d923a249af3 /clang/test
parent1d76120d9ad078c13453433621fa55f8983acd68 (diff)
downloadbcm5719-llvm-f1f20e6802b286e44631c814181e27cf8a5bc947.tar.gz
bcm5719-llvm-f1f20e6802b286e44631c814181e27cf8a5bc947.zip
Fix a couple of places where we assumed that non-type template parameters are always rvalues.
llvm-svn: 325095
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaTemplate/nested-template.cpp7
-rw-r--r--clang/test/SemaTemplate/sizeof-pack.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/nested-template.cpp b/clang/test/SemaTemplate/nested-template.cpp
index 44cb82e95bb..efbde2076b9 100644
--- a/clang/test/SemaTemplate/nested-template.cpp
+++ b/clang/test/SemaTemplate/nested-template.cpp
@@ -161,3 +161,10 @@ class Outer1 {
template <typename T> struct X;
template <typename T> int X<T>::func() {} // expected-error{{out-of-line definition of 'func' from class 'X<T>' without definition}}
};
+
+namespace RefPack {
+ template<const int &...N> struct A { template<typename ...T> void f(T (&...t)[N]); };
+ constexpr int k = 10;
+ int arr[10];
+ void g() { A<k>().f(arr); }
+}
diff --git a/clang/test/SemaTemplate/sizeof-pack.cpp b/clang/test/SemaTemplate/sizeof-pack.cpp
new file mode 100644
index 00000000000..4b0c883a24a
--- /dev/null
+++ b/clang/test/SemaTemplate/sizeof-pack.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+// expected-no-diagnostics
+
+template<int &...Ns> int f() {
+ return sizeof...(Ns);
+}
+template int f<>();
OpenPOWER on IntegriCloud