diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-12-12 23:24:39 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-12-12 23:24:39 +0000 |
commit | 025131601d57ff1e531bbf07575061eb498ba416 (patch) | |
tree | 80964e51fc3d1d2823841c72cf6bbde3ab120a7f /clang/test/SemaTemplate/ms-if-exists.cpp | |
parent | 7c5c789e385b59937d890f17d7eca6bf08f60699 (diff) | |
download | bcm5719-llvm-025131601d57ff1e531bbf07575061eb498ba416.tar.gz bcm5719-llvm-025131601d57ff1e531bbf07575061eb498ba416.zip |
Implement the Microsoft __if_exists/if_not_exists extension in initializer-list.
Necessary to parse Microsoft ATL code.
Example:
int array[] = {
0,
__if_exists(CLASS::Type) {2, }
3
};
will declare an array of 2 or 3 elements depending on if CLASS::Type exists or not.
llvm-svn: 146447
Diffstat (limited to 'clang/test/SemaTemplate/ms-if-exists.cpp')
-rw-r--r-- | clang/test/SemaTemplate/ms-if-exists.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/ms-if-exists.cpp b/clang/test/SemaTemplate/ms-if-exists.cpp index 8ac4e2418cf..04f4a636236 100644 --- a/clang/test/SemaTemplate/ms-if-exists.cpp +++ b/clang/test/SemaTemplate/ms-if-exists.cpp @@ -47,6 +47,12 @@ void f(T t) { int *i = t; // expected-error{{no viable conversion from 'HasFoo' to 'int *'}} { } } + + int array2[] = {
+ 0,
+ __if_exists(T::bar) {2, }// expected-warning{{dependent __if_exists declarations are ignored}}
+ 3
+ };
} template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}} |