aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/ms-if-exists.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-10-25 03:44:56 +0000
committerDouglas Gregor <dgregor@apple.com>2011-10-25 03:44:56 +0000
commit65019acfc46ffb191fac4e781ac0c4b8d0c8434e (patch)
tree7162170291c99c1201ad447a852873a489a146ce /test/SemaTemplate/ms-if-exists.cpp
parent42edac0092749eff3ba881d1b9a425b4f1c9c049 (diff)
Check for unexpanded parameter packs in the name that guards a
Microsoft __if_exists/__if_not_exists statement. Also note that we weren't traversing DeclarationNameInfo *at all* within the RecursiveASTVisitor, which would be rather fatal for variadic templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/ms-if-exists.cpp')
-rw-r--r--test/SemaTemplate/ms-if-exists.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/SemaTemplate/ms-if-exists.cpp b/test/SemaTemplate/ms-if-exists.cpp
index 129dfa7fef..8ac4e2418c 100644
--- a/test/SemaTemplate/ms-if-exists.cpp
+++ b/test/SemaTemplate/ms-if-exists.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions %s -verify
+// RUN: %clang_cc1 -fms-extensions -std=c++11 %s -verify
struct Nontemplate {
typedef int type;
@@ -51,3 +51,12 @@ void f(T t) {
template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}
template void f(HasBar);
+
+template<typename T, typename ...Ts>
+void g(T, Ts...) {
+ __if_exists(T::operator Ts) { // expected-error{{__if_exists name contains unexpanded parameter pack 'Ts'}}
+ }
+
+ __if_not_exists(Ts::operator T) { // expected-error{{__if_not_exists name contains unexpanded parameter pack 'Ts'}}
+ }
+}