summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-04-26 02:10:22 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-04-26 02:10:22 +0000
commit04100943da4d678fbd4d2f3b151edfe71d88c26e (patch)
tree9e256be0bd3c1a881ade1a6f2c2a5f0f85ea425a /clang/test/SemaCXX
parent2c287ec9c576b9a12fc0fca3b92b797fa204ec2a (diff)
downloadbcm5719-llvm-04100943da4d678fbd4d2f3b151edfe71d88c26e.tar.gz
bcm5719-llvm-04100943da4d678fbd4d2f3b151edfe71d88c26e.zip
Diagnose missing template arguments for a variable template even when there is
a preceding 'template' keyword. We only diagnose in the dependent case (wherein we used to crash). Another bug prevents the diagnostic from appearing in the non-template case. llvm-svn: 330894
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
index 6471cd84183..2e1c9a43969 100644
--- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
+++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
@@ -379,3 +379,19 @@ int main() {
} // end ns PR24473
#endif // CPP1Y
+
+namespace dependent_static_var_template {
+ struct A {
+ template<int = 0> static int n; // expected-note {{here}}
+ };
+ int &r = A::template n; // FIXME: ill-formed
+
+ template<typename T>
+ int &f() { return T::template n; } // expected-error {{use of variable template 'n' requires template arguments}}
+ int &s = f<A>(); // expected-note {{instantiation of}}
+
+ namespace B {
+ template<int = 0> static int n;
+ }
+ int &t = B::template n; // FIXME: ill-formed
+}
OpenPOWER on IntegriCloud