summaryrefslogtreecommitdiffstats
path: root/clang/test/PCH/cxx1z-using-declaration.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-12-20 21:35:28 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-12-20 21:35:28 +0000
commit151c4568581f1d6aea266aceb99f7cc683bfc10c (patch)
tree6a06c7b529f20ce83059a547db77184e03e303f1 /clang/test/PCH/cxx1z-using-declaration.cpp
parentd5508b4e89f8e3dcbf83d9eadbb77b2420ea5202 (diff)
downloadbcm5719-llvm-151c4568581f1d6aea266aceb99f7cc683bfc10c.tar.gz
bcm5719-llvm-151c4568581f1d6aea266aceb99f7cc683bfc10c.zip
[c++1z] P0195R2: Support pack-expansion of using-declarations.
This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. This is a re-commit of r290080 (reverted in r290092) with a fix for a use-after-lifetime bug. llvm-svn: 290203
Diffstat (limited to 'clang/test/PCH/cxx1z-using-declaration.cpp')
-rw-r--r--clang/test/PCH/cxx1z-using-declaration.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/PCH/cxx1z-using-declaration.cpp b/clang/test/PCH/cxx1z-using-declaration.cpp
new file mode 100644
index 00000000000..a185ff17404
--- /dev/null
+++ b/clang/test/PCH/cxx1z-using-declaration.cpp
@@ -0,0 +1,35 @@
+// No PCH:
+// RUN: %clang_cc1 -pedantic -std=c++1z -include %s -verify %s
+//
+// With PCH:
+// RUN: %clang_cc1 -pedantic -std=c++1z -emit-pch %s -o %t
+// RUN: %clang_cc1 -pedantic -std=c++1z -include-pch %t -verify %s
+
+#ifndef HEADER
+#define HEADER
+
+template<typename ...T> struct A : T... {
+ using T::f ...;
+ template<typename ...U> void g(U ...u) { f(u...); }
+};
+
+struct X { void f(); };
+struct Y { void f(int); };
+struct Z { void f(int, int); };
+
+inline A<X, Y, Z> a;
+
+#else
+
+void test() {
+ a.g();
+ a.g(0);
+ a.g(0, 0);
+ // expected-error@13 {{no match}}
+ // expected-note@16 {{candidate}}
+ // expected-note@17 {{candidate}}
+ // expected-note@18 {{candidate}}
+ a.g(0, 0, 0); // expected-note {{instantiation of}}
+}
+
+#endif
OpenPOWER on IntegriCloud