diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-10-25 03:44:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-10-25 03:44:56 +0000 |
commit | 4a2a8f7fb857c79c78dd43253706b8fa86c49c8f (patch) | |
tree | 3fa660ab15e7de27e73e19b1cf0c41306ccabb8d /clang/test | |
parent | 016055fa693f20923d68800018d7a8b30a958b56 (diff) | |
download | bcm5719-llvm-4a2a8f7fb857c79c78dd43253706b8fa86c49c8f.tar.gz bcm5719-llvm-4a2a8f7fb857c79c78dd43253706b8fa86c49c8f.zip |
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.
llvm-svn: 142906
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaTemplate/ms-if-exists.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/SemaTemplate/ms-if-exists.cpp b/clang/test/SemaTemplate/ms-if-exists.cpp index 129dfa7feff..8ac4e2418cf 100644 --- a/clang/test/SemaTemplate/ms-if-exists.cpp +++ b/clang/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'}} + } +} |